How to use the vincenty distance calculator
- Enter the start and end latitude and longitude in decimal degrees. South and west are negative.
- Read the distance on the WGS84 ellipsoid in meters, kilometers, miles and nautical miles.
- Read the initial azimuth at the start and the final azimuth at the end.
- Compare with the spherical haversine distance to see how much the shape of the Earth matters.
Formula
Ellipsoid: a = 6,378,137 m, flattening f = 1 / 298.257223563, b = a (1 - f)
Reduced latitude: tan(U) = (1 - f) tan(latitude)
Iterate lambda = L + (1 - C) f sin(alpha) (sigma + C sin(sigma) (cos(2 sigma m) + ...)) until it changes by less than 1e-12
Distance s = b A (sigma - delta sigma), with A and B series in u squared
Vincenty's inverse method (1975) solves the shortest path on an ellipsoid between two points. The page compares it with the haversine formula on a sphere of radius 6,371,008.8 m.
A survey line and an ocean crossing
The published pair from Flinders Peak to Buninyong in Australia (37 degrees 57 minutes 3.72030 seconds S, 144 degrees 25 minutes 29.52440 seconds E to 37 degrees 39 minutes 10.15610 seconds S, 143 degrees 55 minutes 35.38390 seconds E) is 54,972.271 m apart, with an initial azimuth of 306.86816 degrees and a final azimuth of 307.17363 degrees. The spherical result is 54,925.508 m, which is 46.763 m or 0.0851 percent shorter.
New York (40.7128, -74.006) to London (51.5074, -0.1278) is 5,585,233.579 m, and the spherical formula is 15,003.705 m shorter, or 0.269 percent. A Karney geodesic solver gives the same distances to the micrometer.
Ellipsoid and sphere
The Earth is slightly flattened, wider at the equator than between the poles. A spherical formula uses one average radius, so it can be off by a few tenths of a percent, depending on the direction of travel. Vincenty's method follows the ellipsoid and is accurate to well under a millimeter for ordinary pairs of points, which is why surveyors use it.
For a quick spherical distance, use the great circle distance calculator. The bearing and azimuth converter changes direction formats, and the coordinate format converter handles degrees, minutes and seconds.
When the method fails
For points that are almost opposite each other on the Earth, the iteration does not settle, and the page says so instead of showing a wrong number. Moving one point a little usually fixes it. The azimuths are measured clockwise from north, and the final azimuth is the direction of travel when you arrive.
Assumptions and limits
- The points are on the WGS84 ellipsoid at sea level, and heights are ignored.
- Latitude and longitude are decimal degrees. Convert degrees, minutes and seconds first.
- The distance is the shortest path along the surface of the ellipsoid.
- The haversine comparison uses a sphere of radius 6,371,008.8 m.
Frequently asked questions
What is the Vincenty formula?
It is an iterative method for the shortest distance and the azimuths between two points on an ellipsoid. It is far more accurate than a spherical formula for long lines.
How much does Vincenty differ from haversine?
It depends on the direction and length of the line, up to about 0.5 percent. Between New York and London the spherical result is about 0.27 percent short.
Why does the page sometimes refuse to compute?
The iteration can fail for nearly antipodal points. Move one point a little and try again.
What do the azimuths mean?
The initial azimuth is the compass direction from the start toward the end, measured clockwise from true north. The final azimuth is the direction of travel at the end point.