Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
from math import *
def haversine(koord1,koord2):
"""
Calculate the great circle distance between two points
on the earth (specified in decimal degrees)
"""
# convert decimal degrees to radians
lon1, lat1, lon2, lat2 = map(radians, [koord1[0],koord1[1],koord2[0],koord2[1]])
# haversine formula
dlon = lon2 - lon1
dlat = lat2 - lat1
a = sin(dlat/2)**2 + cos(lat1) * cos(lat2) * sin(dlon/2)**2
c = 2 * asin(sqrt(a))
# Radius of earth in kilometers is 6371
dist = 6371000 * c
return dist
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question