euclidean_distance(x1: float, x2: float, y1: float, y2: float) → float¶
Calculates Euclidean (straight line) distance between (x1, y1) and (x2, y2).
- x1: float
x-coordinate of the first point.
- x2: float
x-coordinate of the second point.
- y1: float
y-coordinate of the first point.
- y2: float
y-coordinate of the second point.
- distance: float
Euclidean distance between two points.
Algorithm References: - Wikipedia, Euclidean Distance, https://en.wikipedia.org/wiki/Euclidean_distance#:~:text=In%20mathematics%2C%20the%20Euclidean%20distance,being%20called%20the%20Pythagorean%20distance, Accessed Apr. 22, 2021. # noqa
Imports >>> from xrspatial import euclidean_distance as ed >>> point_a = (142.32, 23.23) >>> point_b = (312.54, 432.01)
Calculate Euclidean Distance >>> dist = ed(point_a, point_b, point_a, point_b) >>> print(dist) 442.80462599209596