Created
August 22, 2021 18:53
-
-
Save lmeulen/e161536d56842c5fbd91599e51624090 to your computer and use it in GitHub Desktop.
gpx_distance_haversine
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def dist_haversine(lat1, lon1, lat2, lon2): | |
radius = 6371.0088 | |
lat = lat2 - lat1 | |
lon = lon2 - lon1 | |
d = sin(lat * 0.5) ** 2 + cos(lat1) * cos(lat2) * sin(lon * 0.5) ** 2 | |
return 2 * radius * asin(sqrt(d)) * 1000 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment