The formulae in this article calculate distances between points which are defined by geographical coordinates in terms of latitude and longitude.
Calculation of distances which account for changes in elevation relative to the idealized surface are not discussed in this article.
In the given forms of the formulae below, one or more values must be expressed in the specified units to obtain the correct result.
Differences in latitude and longitude are labeled and calculated as follows: It is not important whether the result is positive or negative when used in the formulae below.
= Distance between the two points, as measured along the surface of the Earth and in the same units as the value used for radius unless specified otherwise.
Also, planar projections of the circles of constant latitude are highly curved near the Poles.
If a calculation based on latitude/longitude should be valid for all Earth positions, it should be verified that the discontinuity and the Poles are handled correctly.
The shortest distance between two points in plane is a Cartesian straight line.
The projection of latitude and longitude coordinates onto a plane is the realm of cartography.
The formulae presented in this section provide varying degrees of accuracy.
On the other hand, some methods for computing nearest neighbors, such as the vantage-point tree, require that the distance metric obey the triangle inequality, in which case the square root must be retained.
, justified except for high latitude: The above formula is extended for ellipsoidal Earth: where
are the meridional and its perpendicular, or "normal", radii of curvature of Earth (See also "Geographic coordinate conversion" for their formulas).
, justified except for high latitude as above:[2][3] The Federal Communications Commission (FCC) prescribes the following formulae for distances not exceeding 475 kilometres (295 mi):[4]
If one is willing to accept a possible error of 0.5%, one can use formulas of spherical trigonometry on the sphere that best approximates the surface of the Earth.
The great-circle distance article gives the formula for calculating the shortest arch length
Geodesics follow more complicated paths than great circles and in particular, they usually don't return to their starting positions after one circuit of the Earth.
Finding the geodesic between two points on the Earth, the so-called inverse geodetic problem, was the focus of many mathematicians and geodesists over the course of the 18th and 19th centuries with major contributions by Clairaut,[5] Legendre,[6] Bessel,[7] and Helmert English translation of Astron.
Methods for computing the geodesic distance are widely available in geographical information systems, software libraries, standalone utilities, and online tools.
This defect is cured in the algorithm given by Karney,[11] who employs series which are accurate to sixth order in the flattening.
This results in an algorithm which is accurate to full double precision and which converges for arbitrary pairs of points on the Earth.
[14] Karl Hubeny[15] got the expanded series of Gauss mid-latitude one represented as the correction to flat-surface one.
Historically, the long-line formulae were derived in the form of expansion series with regard to flattening
on a sphere using the Great-circle distance method (haversine formula), with longitudes
On the GRS 80 spheroid Lambert's formula is off by It has the similar form of the arc length converted from tunnel distance.
Bowring maps the points to a sphere of radius R′, with latitude and longitude represented as φ′ and λ′.
Define where the second eccentricity squared is The spherical radius is (The Gaussian curvature of the ellipsoid at φ1 is 1/R′2.)
The resulting problem on the sphere may be solved using the techniques for great-circle navigation to give approximations for the spheroidal distance and bearing.
[19] The variation in altitude from the topographical or ground level down to the sphere's or ellipsoid's surface, also changes the scale of distance measurements.
[20] The slant distance s (chord length) between two points can be reduced to the arc length on the ellipsoid surface S as:[21] where R is evaluated from Earth's azimuthal radius of curvature and h are ellipsoidal heights are each point.