Calculating the distance between geographical coordinates is based on some level of abstraction; it does not provide an exact distance, which is unattainable if one attempted to account for every irregularity in the surface of the Earth.[1] Common abstractions for the surface between two geographic points are:
Flat surface;
Spherical surface;
Ellipsoidal surface.
All abstractions above ignore changes in elevation. Calculation of distances which account for changes in elevation relative to the idealized surface are not discussed in this article.
Tunnel-distance based approximations: Flat surface, Gauss-mid-latitude;
0-th-order approximation: Spherical surface;
higher-order approximations based on Ellipsoid: : Andoyer(1932); Andoyer-Lambert(1942), : Andoyer-Lambert-Thomas(1970), : Vincenty(1975), : Kaney(2011); on the hemisphere
The theoretical estimations of error are added in above and is the flattening of the Earth.
Arc distance, is the minimum distance along the surface of sphere/ellipsoid calculated between two points, and . Whereas, the tunnel distance, or chord length, , is measured along Cartesian straight line. The geographical coordinates of the two points, as (latitude, longitude) pairs, are and respectively. Which of the two points is designated as is not important for the calculation of distance.
Latitude and longitude coordinates on maps are usually expressed in degrees. In the given forms of the formulae below, one or more values must be expressed in the specified units to obtain the correct result. Where geographic coordinates are used as the argument of a trigonometric function, the values may be expressed in any angular units compatible with the method used to determine the value of the trigonometric function. Many electronic calculators allow calculations of trigonometric functions in either degrees or radians. The calculator mode must be compatible with the units used for geometric coordinates.
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.
"Mean latitude" is labeled and calculated as follows:
Unless specified otherwise, the radius of the Earth for the calculations below is:
= 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.
Singularities and discontinuity of latitude/longitude
The approximation of sinusoidal functions of , appearing in some flat-surface formulae below, may induce singularity and discontinuity. It may also degrade the accuracy in the case of higher latitude.
Longitude has singularities at the Poles (longitude is undefined) and a discontinuity at the ±180° meridian. Also, planar projections of the circles of constant latitude are highly curved near the Poles. Hence, the above equations for delta latitude/longitude (, ) and mean latitude () may not give the expected answer for positions near the Poles or the ±180° meridian. Consider e.g. the value of ("east displacement") when and are on either side of the ±180° meridian, or the value of ("mean latitude") for the two positions (=89°, =45°) and (=89°, =−135°).
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. Another solution is to use n-vector instead of latitude/longitude, since this representation does not have discontinuities or singularities.
Flat-surface approximation formulae for very short distance
A planar approximation for the surface of the Earth may be useful over very small distances. It approximates the arc length, , to the tunnel distance, , or omits the conversion between arc and chord lengths shown below.
The shortest distance between two points in plane is a Cartesian straight line. The Pythagorean theorem is used to calculate the distance between points in a plane.
Even over short distances, the accuracy of geographic distance calculations which assume a flat Earth depend on the method by which the latitude and longitude coordinates have been projected onto the plane. 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.
The FCC prescribes the following formulae for distances not exceeding 475 kilometres (295 mi):[4]
where
= Distance in kilometers;
and are in degrees;
must be in units compatible with the method used for determining
Where and are in units of kilometers per arc degree. They are derived from radii of curvature of Earth as follows:
= kilometers per arc degree of latitude difference;
= kilometers per arc degree of longitude difference;
Note that the expressions in the FCC formula are derived from the truncation of the binomial series expansion form of and , set to the Clarke 1866reference ellipsoid. For a more computationally efficient implementation of the formula above, multiple applications of cosine can be replaced with a single application and use of recurrence relation for Chebyshev polynomials.
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 shortest distance along the surface of a sphere between two points on the surface is along the great-circle which contains the two points.
The great-circle distance article gives the formula for calculating the shortest arch length on a sphere about the size of the Earth. That article includes an example of the calculation. For example, from tunnel distance,
A tunnel between points on Earth is defined by a Cartesian line through three-dimensional space between the points of interest.
The tunnel distance is the great-circle chord length and may be calculated as follows for the corresponding unit sphere:
An ellipsoid approximates the surface of the Earth much better than a
sphere or a flat surface does. The shortest distance along the surface
of an ellipsoid between two points on the surface is along the
geodesic. 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. This is illustrated in the
figure on the right where f is taken to be 1/50 to accentuate the
effect. 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. Nachr.4, 241–254 (1825). Errata.[8]
Rapp[9]
provides a good summary of this work.
Methods for computing the geodesic distance are widely available in
geographical information systems, software libraries, standalone
utilities, and online tools. The most widely used algorithm is by
Vincenty,[10]
who uses a series which is accurate to third order in the flattening of
the ellipsoid, i.e., about 0.5 mm; however, the algorithm fails to
converge for points that are nearly antipodal. (For
details, see Vincenty's formulae.) 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. This
algorithm is implemented in GeographicLib.[12]
The exact methods above are feasible when carrying out calculations on a
computer. They are intended to give millimeter accuracy on lines of any
length; one can use simpler formulas if one doesn't need millimeter
accuracy, or if one does need millimeter accuracy but the line is short.
The short-line methods have been studied by several researchers.
Rapp,[13] Chap. 6, describes the Puissant method,
the Gauss mid-latitude method, and the Bowring method.[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.[16][17]
Lambert's formulae[18]
use the first-order correction and reduced latitude, , for better accuracy. They give accuracy on the order of 10 meters over thousands of kilometers.
It has the similar form of the arc length converted from tunnel distance. Detailed formulas are given by Rapp,[13] §6.4. It is consistent with the above-mentioned flat-surface formulae apparently.
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 spherical coordinates are given by
where , ,
, . 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. Detailed formulas are given by Rapp[13] §6.5, Bowring,[14] and Karney.[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]
^"Reference points and distance computations"(PDF). Code of Federal Regulations (Annual Edition). Title 47: Telecommunication. 73 (208). October 1, 2016. Retrieved 8 November 2017.
^Henri Andoyer: Formule donnant la longueur de la géodésique joignant 2 points de l’ellipsoïde donnés par leurs coordonnées géographiques, Bulletin Géodésique, Volume 34, Number 1, April 1932, pages 77–81, https://doi.org/10.1007%2FBF03030136
^
Lambert, W. D (1942). "The distance between two widely separated points on the surface of the earth". J. Washington Academy of Sciences. 32 (5): 125–130.