Distance Calculation Algorithms

There are many ways to calculate the distance between two points on the Earth's surface, defined by their latitude and longitude. The methods vary in complexity and accuracy. Generally the simpler the method, the less accurate it is.

Explanation of terms

L1 = latitude at the first point (degrees)
L2 = latitude at the second point (degrees)
G1 = longitude at the first point (degrees)
G2 = longitude at the second point (degrees)
DG = longitude of the second point minus longitude of the first point (degrees)
DL = latitude of the second point minus latitude of the first point (degrees)
D = computed distance (km)


  • South latitudes are negative
  • East longitudes are positive
  • Great circle distance is the shortest distance between two points on a sphere. This coincides with the circumference of a circle which passes through both points and the centre of the sphere
  • Geodesic distance is the shortest distance between two points on a spheroid
  • Normal section distance is formed by a plane on a spheroid containing a point at one end of the line and the normal of the point at the other end. For all practical purposes, the difference between a normal section and a geodesic distance is insignificant.

Great Circle Distance (based on Spherical trigonometry)

This method calculates the great circle distance, and is based on spherical trigonometry, and assumes that:
  • 1 minute of arc is 1 nautical mile
  • 1 nautical mile is 1.852 km.

D = 1.852 * 60 * ARCOS ( SIN(L1) * SIN(L2) + COS(L1) * COS(L2) * COS(DG))

Note: If your calculator returns the ARCOS result as radians, you will have to convert the radians to degrees before multiplying by 60 and 1.852 degrees = (radians/PI)*180, where PI=3.141592654.

Spheroidal model for the Earth

This method assumes a spheroidal model for the Earth with an average radius of 6364.963km. It has been derived for use within Australia.

The formula is estimated to have an accuracy of about 200 metres over 50km, but may deteriorate with longer distances.

TERM1 = 111.08956 * (DL + 0.000001)
TERM2 = COS(L1 + (DL/2)
TERM3 = (DG + 0.000001) / (DL + 0.000001)


Comparison of methods

The Table below shows distances calculated by each of the methods above. Vincenty's formulae (method 3), is the "best" answer and can be used for comparison with the others.

However, remember that the different methods compute different types of distance (great circle, geodesic etc), and you must decide which type of system (distance) you wish to use.

The test lines shown are neither exhaustive nor complete, but are indicative of the accuracies which may be obtained. Method 4 uses the GRS80 ellipsoid, which is used with Geocentric Datum of Australia (GDA) coordinate system. This ellipsoid is effectively the same as the WGS84 ellipsoid used with the Global Positioning System (GPS). All distances are in kilometres.

Method 1 Method 2 Method 3
To Great Circle Approx. ellip. Vincenty's
A A 0.000 0.000 0.000
A B 111.120 111.089 110.861
A C 146.677 146.645 146.647
A D 241.787 241.728 241.428
A E 346.556 346.469 345.929
A F 454.351 454.237 453.493
A G 563.438 563.294 562.376
A H 1114.899 1114.616 1113.142
A I 2223.978 2223.420 2222.323
A J 3334.440 3333.612 3334.804
A K 4445.247 4444.156 4449.317
A L 5556.190 5554.843 5565.218
Point Latitude Longitude
A -30 150
B -31 150
C -31 151
D -32 151
E -33 151
F -34 151
G -35 151
H -40 151
I -50 151
J -60 151
K -70 151
L -80 151