Syntax of osmnx.distance.great_circle() Function
The vectorized function calculates the great-circle distance between two points’ coordinates or between arrays of points’ coordinates using the haversine formula.
osmnx.distance.great_circle(lat1, lon1, lat2, lon2, earth_radius=6371009)
Note: coordinates in decimal degrees.
Parameters:
- lat1 (float or numpy.array of float) – first point’s latitude coordinate
- lon1 (float or numpy.array of float) – first point’s longitude coordinate
- lat2 (float or numpy.array of float) – second point’s latitude coordinate
- lon2 (float or numpy.array of float) – second point’s longitude coordinate
- earth_radius (float) – earth’s radius in units in which distance will be returned (default is meters)
Returns: dist – distance from each (lat1, lon1) to each (lat2, lon2) in units of earth_radius
Return Type: float or numpy.array of float
Calculate Great Circle Distances Between Pairs of Points Using OSMnx Module
The Great Circle Distance evaluates the shortest distance between two points considering Earth as a sphere. It is an arc linking two points on a sphere. Here, we will see how to calculate great circle distances between pairs of points using the OSMnx distance module.