Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

One common way to determine the distance between two sets of geographic coordinates specified as latitude and longitude is to use the Haversine formula.

The formula is:

distance = 2 * r * arcsin( sqrt( sin^2((lat2-lat1)/2) + cos(lat1) * cos(lat2) * sin^2((lon2-lon1)/2) ) )

Where - distance is the distance between the two locations in kilometers - r is the radius of the Earth, typically 6,371 km - lat1 and lat2 are the latitude coordinates of the two locations - lon1 and lon2 are the longitude coordinates of the two locations

Note that the latitude and longitude should be in radians, so convert them from degrees to radians before plugging them into the formula.

There are also many online calculators that can automatically calculate the distance between two sets of coordinates using the Haversine formula.