Toolvito

Works on this device

Geodesic Distance Calculator

Work out the shortest distance on the Earth’s ellipsoid between two points, with the azimuth at each end, or find where you arrive from a start point, an azimuth and a distance. The haversine distance on a sphere is shown beside it for comparison.

Enter your values

The shortest distance on the ellipsoid between two points (the geodesic), with the azimuth at the start and at the end. This is the inverse geodesic problem.

Your values

Latitude, then longitude, with a comma between them, such as 40.6, -73.8 or 40° 36′ N, 73° 48′ W. South and west are negative.

Typed the same way. The examples are near New York JFK airport (A) and London Heathrow (B).

WGS 84 is the ellipsoid of GPS. Choose your own for an older map datum: type its constants from the datum’s definition.

Your values are worked out in this browser. They are not sent to a server.

Your result will show here

Fill in the values, then choose Calculate.

How to use this calculator

  1. Choose Distance and azimuths between two points (the inverse problem) or End point from a start, an azimuth and a distance (the direct problem).
  2. Type each point as latitude, a comma and longitude, such as 40.6, -73.8, or with degrees, minutes and seconds such as 40° 36′ N, 73° 48′ W.
  3. Type an azimuth as degrees clockwise from true north, such as 51.2 or 51° 12′, or as a quadrant bearing such as N 51° 12′ E.
  4. Keep the WGS 84 ellipsoid, or choose your own and type its a and 1/f. Choose Calculate.

The method

  • WGS 84 is defined by a = 6,378,137 m (the equatorial radius) and 1/f = 298.257223563 (the inverse flattening). Then b = a(1 − f) = 6,356,752.314245 m.
  • Vincenty’s formulae (1975) move the problem to an auxiliary sphere, using the reduced latitude tan U = (1 − f) tan φ. The inverse formula repeats until the longitude on that sphere changes by less than 10⁻¹² radian; the direct formula repeats until the arc changes by less than 10⁻¹² radian.
  • Nearly opposite points: for points close to each other’s antipode, Vincenty’s inverse iteration can fail to settle. The tool then solves the same equations on the auxiliary sphere (s = b ∫ √(1 + k² sin² σ) dσ and λ = ω − f sin α0 ∫ (2 − f) ÷ (1 + (1 − f)√(1 + k² sin² σ)) dσ, as written by Karney, 2013) by a search on the starting azimuth. The result line Method says which way was used.
  • Haversine on a sphere of radius R: h = sin²(Δφ ÷ 2) + cos φ1 × cos φ2 × sin²(Δλ ÷ 2), distance = 2R × atan2(√h, √(1 − h)). With the mean Earth radius it differs from the geodesic by up to about 0.56%.

Worked example

From 40.6, -73.8 (near New York JFK airport) to 51.6, -0.5 (near London Heathrow) on WGS 84, the geodesic distance is 5,551,759.400 m. The initial azimuth is 51.198883° and the final azimuth is 107.821777°. These match the example in the GeographicLib documentation.

The haversine distance on the mean sphere is 5,536,891.987 m, 0.268% shorter.

For the direct problem, setting off from 40.6, -73.8 on the azimuth 51.2° for 5,551.759 km ends at 51.59918732, -0.50042559.

Limits you should know

  • The distance is on the surface of the ellipsoid at height zero. Heights, terrain and the bends of a real route are not included.
  • Ellipsoids with 1/f below 150 are refused: these series are made for Earth-like ellipsoids. For a sphere use the Earth Distance & Area Calculator, which also gives path lengths and areas.
  • For two points opposite each other, the distance is exact but more than one shortest route joins them; the azimuths are those of one of them.
  • No datum shift is made: both points must be in the same datum as the ellipsoid. Coordinates from GPS are in WGS 84.

Related tools