Syntax of osmnx.distance.euclidean() Function
The vectorized function to calculate the Euclidean distance between two points’ coordinates or between arrays of points’ coordinates is as follows:
osmnx.distance.euclidean(y1, x1, y2, x2)
Parameters:
- y1 (float or numpy.array of float) – first point’s y coordinate
- x1 (float or numpy.array of float) – first point’s x coordinate
- y2 (float or numpy.array of float) – second point’s y coordinate
- x2 (float or numpy.array of float) – second point’s x coordinate
Note: For accurate results, use projected coordinates rather than decimal degrees
Returns: dist – distance from each (x1, y1) to each (x2, y2) in coordinates’ units
Return Type: Float or numpy.array of float
Calculate Euclidean Distance Using Python OSMnx Distance Module
Euclidean space is defined as the line segment length between two points. The distance can be calculated using the coordinate points and the Pythagoras theorem. In this article, we will see how to calculate Euclidean distances between Points Using the OSMnx distance module.