uwacan.positional.distance_to#
- distance_to(lat_1, lon_1, lat_2, lon_2)[source]#
Calculate the distance between two coordinates.
Conventions here are λ as the longitude and φ as the latitude. This implementation uses the Haversine formula:
\[\begin{split}c &= H(Δφ) + (1 - H(Δφ) - H(φ_1 + φ_2)) ⋅ H(Δλ)\\ d &= 2 R(φ) ⋅ \arcsin(\sqrt{c})\\ H(θ) &= \sin^2(θ/2)\end{split}\]implemented internally with conversions to geocentric coordinates and a latitude-dependent earth radius.
- Parameters:
- lat_1float
Latitude of the first point in degrees.
- lon_1float
Longitude of the first point in degrees.
- lat_2float
Latitude of the second point in degrees.
- lon_2float
Longitude of the second point in degrees.
- Returns:
- float
Distance between the two points in meters.