def dist_haversine(x0,y0,x1,y1):
    # Use spherical geometry to calculate the surface distance, in meters
    # between two geodesic points. Uses Haversine formula:
    # http://en.wikipedia.org/wiki/Haversine_formula
    radius = 6371000 # Earth mean radius in m
    lon0 = x0 * PI / 180 #rad
    lat0 = y0 * PI / 180 #rad
    lon1 = x1 * PI / 180 #rad
    lat1 = y1 * PI / 180 #rad
    dLat = (lat1 - lat0) #rad
    dLon = (lon1 - lon0) #rad
    a = sin(dLat/2) * sin(dLat/2) + cos(lat0) * cos(lat1) * sin(dLon/2) * sin(dLon/2)
    c = 2 * atan2(sqrt(a), sqrt(1-a))
    return radius * c
dataset/ETHPy150Open bmander/graphserver/pygs/graphserver/ext/osm/osm.py/dist_haversine/original