def gps_distance(lat1, lon1, lat2, lon2):
 lat1 = math.radians(lat1)
 lat2 = math.radians(lat2)
 lon1 = math.radians(lon1)
 lon2 = math.radians(lon2)
 dLat = (lat2 - lat1)
 dLon = (lon2 - lon1)
 a = ((math.sin((0.5 * dLat)) ** 2) + (((math.sin((0.5 * dLon)) ** 2) * math.cos(lat1)) * math.cos(lat2)))
 c = (2.0 * math.atan2(math.sqrt(a), math.sqrt((1.0 - a))))
 return (radius_of_earth * c)

def gps_distance ( lat1 , lon1 , lat2 , lon2 ) : lat1 = math . radians ( lat1 ) lat2 = math . radians ( lat2 ) lon1 = math . radians ( lon1 ) lon2 = math . radians ( lon2 ) dLat = ( lat2 - lat1 ) dLon = ( lon2 - lon1 ) a = ( ( math . sin ( ( 0.5 * dLat ) ) ** 2 ) + ( ( ( math . sin ( ( 0.5 * dLon ) ) ** 2 ) * math . cos ( lat1 ) ) * math . cos ( lat2 ) ) ) c = ( 2.0 * math . atan2 ( math . sqrt ( a ) , math . sqrt ( ( 1.0 - a ) ) ) ) return ( radius_of_earth * c )
return distance between two points in meters .