# Geographical distance

> Mediated Wiki article. Canonical URL: https://mediated.wiki/source/Geographical_distance
> Markdown URL: https://mediated.wiki/source/Geographical_distance.md
> Source: https://en.wikipedia.org/wiki/Geographical_distance
> Source revision: 1339026171
> License: Creative Commons Attribution-ShareAlike 4.0 International (https://creativecommons.org/licenses/by-sa/4.0/)

{{short description|Distance measured along the surface of the Earth}}
[[File:Roßberg Alpen 1.14 2006.jpg|thumb|upright=1.2|View from the [Swabian Jura](/source/Swabian_Jura) to the [Alps](/source/Northern_Limestone_Alps)]]
{{Geodesy}}

'''Geographical distance''' or '''geodetic distance''' is the [distance](/source/distance) measured along the surface of the [Earth](/source/Earth), or the shortest arc length. 

The formulae in this article calculate distances between points which are defined by [geographical coordinates](/source/geographical_coordinates) in terms of [latitude](/source/latitude) and [longitude](/source/longitude). This distance is an element in solving the [second (inverse) geodetic problem](/source/Geodesy).

==Introduction==
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.<ref>{{Cite web |url=http://www.cartography.org.uk/default.asp?contentID=749 |title=The British Cartographic Society > How long is the UK coastline? |access-date=2008-12-06 |archive-date=2012-05-22 |archive-url=https://web.archive.org/web/20120522042745/http://www.cartography.org.uk/default.asp?contentID=749 |url-status=dead }}</ref> 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.

=== Classification of Formulae based on Approximation ===
* short-range approximations: Flat surface, Gauss-mid-latitude; <math>\max |\Delta D_\text{error}| \propto D^3 </math>
** Bowring's method (1981) for short lines improved by Karney using reduces latitude and mid-latitude; <math>\max |\Delta D_\text{error}| \propto D^4 </math>
* long-range approximations; <math>\max |\Delta D_\text{error}| \propto D</math> on the closed hemisphere
** <math>f^0</math>-order approximation method: Spherical surface
** higher-order approximations based on Ellipsoid: <math>f^1</math>: Andoyer(1932); Andoyer-Lambert(1942), <math>f^2</math>: Andoyer-Lambert-Thomas(1970), <math>f^3</math>: Vincenty(1975), <math>f^6</math>: Karney(2011)

The theoretical estimations of error are added  in above and <math>f</math> is the [flattening](/source/flattening) of the Earth.

===Nomenclature===

Arc distance, <math>D,\,\!</math> is the minimum distance along the surface of sphere/ellipsoid calculated between two points, <math>P_1\,\!</math> and <math>P_2\,\!</math>. Whereas, the tunnel distance, or chord length, <math>D_\textrm{t}</math>, is measured along Cartesian straight line. The geographical coordinates of the two points, as (latitude, longitude) pairs, are <math>(\phi_1,\lambda_1)\,\!</math> and <math>(\phi_2,\lambda_2),\,\!</math> respectively. Which of the two points is designated as <math>P_1\,\!</math> is not important for the calculation of distance.

Latitude <math>\phi\,\!</math> and longitude <math>\lambda\,\!</math> coordinates on maps are usually expressed in [degree](/source/degree_(angle))s. 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 [radian](/source/radian)s. The calculator mode must be compatible with the units used for geometric coordinates.

Differences in latitude and longitude are labeled and calculated as follows:
:<math>\begin{align}
\Delta\phi&=\phi_2-\phi_1;\\
\Delta\lambda&=\lambda_2-\lambda_1.
\end{align}
\,\!</math>

It is not important whether the result is positive or negative when used in the formulae below.

"Mid-latitude" is labeled and calculated as follows:
:<math>\phi_\mathrm{m}=\frac{\phi_1+\phi_2}{2}.\,\!</math>

Unless specified otherwise, the [radius](/source/Earth_radius) of the Earth for the calculations below is:
:<math>R\,\!</math> = 6,371.009 kilometers = 3,958.761 statute miles = 3,440.069 [nautical mile](/source/nautical_mile)s.

<math>D_\,\!</math> = 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 <math>\Delta \lambda</math>, 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](/source/Mathematical_singularity) at the [Poles](/source/Geographical_pole) (longitude is undefined) and a [discontinuity](/source/Discontinuity_(mathematics)) at the ±[180° meridian](/source/180th_meridian). Also, planar projections of the [circles of constant latitude](/source/Circle_of_latitude) are highly curved near the Poles. Hence, the above equations for [delta](/source/Delta_(letter)) latitude/longitude (<math>\Delta\phi\!</math>, <math>\Delta\lambda\!</math>) and mid-latitude (<math>\phi_\mathrm{m}\!</math>) may not give the expected answer for positions near the Poles or the ±180° meridian. Consider e.g.  the value of <math>\Delta\lambda\!</math> ("east displacement") when <math>\lambda_1\!</math> and <math>\lambda_2\!</math> are on either side of the ±180° meridian, or the value of <math>\phi_\mathrm{m}\!</math> ("mid-latitude") for the two positions (<math>\phi_1\!</math>=89°, <math>\lambda_1\!</math>=45°) and (<math>\phi_2\!</math>=89°, <math>\lambda_2\!</math>=−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](/source/n-vector) instead of latitude/longitude, since this [representation](/source/horizontal_position_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, <math>D</math>, to the tunnel distance, <math>D_\textrm{t}</math>, or omits the conversion between arc and chord lengths shown below.
 <!--The accuracy of distance calculations using this approximation become increasingly inaccurate as:
* The separation between the points becomes greater;-->
<!--* A point becomes closer to a geographic pole.-->

The shortest distance between two points in plane is a Cartesian straight line. The [Pythagorean theorem](/source/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](/source/map_projection) onto the plane. The projection of latitude and longitude coordinates onto a plane is the realm of [cartography](/source/cartography).

The formulae presented in this section provide varying degrees of accuracy.

===Spherical Earth approximation formulae ===

The tunnel distance, <math>D_\textrm{t}</math>, is calculated on Spherical Earth. This formula takes into account the variation in distance between meridians with latitude, assuming <math>D \approx D_\textrm{t}</math>:

:<math>
\begin{align}
D_\textrm{t} &= 2 R \sqrt{ \left(\sin \frac{\Delta \phi}{2} \, \cos \frac{\Delta \lambda}{2} \right)^2 + \left(\cos\phi_\textrm{m} \sin \frac{\Delta \lambda}{2} \right)^2} \\
&\approx R \sqrt{ \left( \Delta \phi \, \cos \frac{\Delta \lambda}{2} \right)^2 + \left(2 \cos\phi_\textrm{m} \sin \frac{\Delta \lambda}{2} \right)^2} \ .
\end{align} </math>

The square root appearing above can be eliminated for such applications as ordering locations by distance in a database query.  On the other hand, some methods for computing nearest neighbors, such as the [vantage-point tree](/source/vantage-point_tree), require that the distance metric obey the [triangle inequality](/source/triangle_inequality), in which case the square root must be retained.

====In the case of medium or low latitude====
Although not being universal, the above is furthermore simplified by approximating sinusoidal functions of <math>\frac{\Delta \lambda}{2}</math>, justified except for high latitude:

:<math>D \approx R\sqrt{(\Delta\phi)^2+(\cos(\phi_\mathrm{m})\Delta\lambda)^2}</math>.
<!--This approximation is very fast and produces fairly accurate result for small distances {{Citation needed|date=October 2010}}. Also, when ordering locations by distance, such as in a database query, it is faster to order by squared distance, eliminating the need for computing the square root.-->

===Ellipsoidal Earth approximation formulae===
The above formula is extended for ellipsoidal Earth:

:<math>
\begin{align}
D &\approx 2 \sqrt{ \left(M\left(\phi_\textrm{m}\right) \sin \frac{\Delta \phi}{2} \, \cos \frac{\Delta \lambda}{2} \right)^2 + \left( N\left(\phi_\textrm{m}\right) \cos\phi_\textrm{m} \sin \frac{\Delta \lambda}{2}  \right)^2}, \\
&\approx \sqrt{ \left(M\left(\phi_\textrm{m}\right) \Delta \phi \, \cos \frac{\Delta \lambda}{2} \right)^2 + \left(2 N\left(\phi_\textrm{m}\right) \cos\phi_\textrm{m} \sin \frac{\Delta \lambda}{2}  \right)^2},
\end{align}
</math>
where <math>M\,\!</math> and <math>N\,\!</math> are the '''''m'''eridional'' and its perpendicular, or "'''''n'''ormal''", [radii of curvature of Earth](/source/Earth_radius) (See also "[Geographic coordinate conversion](/source/Geographic_coordinate_conversion)" for their formulas).

It is derived by the approximation of <math>\left(\cos \phi_\textrm{m} \sin\frac{\Delta \lambda}{2} \Delta \phi \right)^2 \approx 0</math> in the square root.

This approximation can be viewed simply as the 3D Cartesian chord distance between two points on the ellipsoid, and equivalently as a chordal simplification of the Gauss mid-latitude method. Although we have not found this explicit formula in classical sources, the Gauss mid-latitude method itself is described in Rapp (1991).

====In the case of medium or low latitude====
Although not being universal, the above is furthermore simplified by approximating sinusoidal functions of <math>\frac{\Delta \lambda}{2}</math>, justified except for high latitude as above:<ref>{{Cite web |url=https://edwilliams.org/avform147.htm#flat |title=Aviation Formulary. |last = Williams |first = E. |date = 2013|access-date=2024-06-23}}</ref><ref>{{Cite web |url=https://edwilliams.org/ellipsoid/ellipsoid.html |title=Navigation on the spheroidal earth. |last = Williams |first = E. |date = 2002|access-date=2023-11-28}}</ref>

:<math>D \approx \sqrt{(M(\phi_\mathrm{m})\Delta\phi)^2+(N(\phi_\mathrm{m})\cos\phi_\mathrm{m}\Delta\lambda)^2}.</math>

==== FCC's formula ====
The [Federal Communications Commission](/source/Federal_Communications_Commission) (FCC) prescribes the following formulae for distances not exceeding {{convert|475|km|mi}}:<ref>{{cite journal|title=Reference points and distance computations|journal=Code of Federal Regulations (Annual Edition). Title 47: Telecommunication.|date=October 1, 2016|volume=73|issue=208|url=https://www.gpo.gov/fdsys/pkg/CFR-2016-title47-vol4/pdf/CFR-2016-title47-vol4-sec73-208.pdf|access-date=8 November 2017}}</ref>

:<math>D \approx \sqrt{(K_1\Delta\phi)^2+(K_2\Delta\lambda)^2},</math>
:where
::<math>D\,\!</math> = Distance in kilometers;
::<math>\Delta\phi\,\!</math> and <math>\Delta\lambda\,\!</math> are in degrees;
::<math>\phi_\mathrm{m}\,\!</math> must be in units compatible with the method used for determining <math>\cos \phi_\mathrm{m} ;\,\!</math>
::<math>\begin{align}
K_1&=111.13209-0.56605\cos(2\phi_\mathrm{m})+0.00120\cos(4\phi_\mathrm{m});\\
K_2&=111.41513\cos(\phi_\mathrm{m})-0.09455\cos(3\phi_\mathrm{m})+0.00012\cos(5\phi_\mathrm{m}).\end{align}\,\!</math>

:Where <math>K_1</math> and <math>K_2</math> are in units of kilometers per arc degree. They are derived from [radii of curvature of Earth](/source/Earth_radius) as follows:
::<math>K_1=M(\phi_\mathrm{m})\frac{\pi}{180}\,\!</math> = kilometers per arc degree of latitude difference;
::<math>K_2=\cos(\phi_\mathrm{m})N(\phi_\mathrm{m})\frac{\pi}{180}\,\!</math> = kilometers per arc degree of longitude difference;
:Note that the expressions in the FCC formula are derived from the truncation of the [binomial series](/source/binomial_series) expansion form of <math>M\,\!</math> and <math>N\,\!</math>, set to the ''Clarke 1866'' [reference ellipsoid](/source/reference_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](/source/Chebyshev_polynomials).

===Polar coordinate flat-Earth formula===
<math>D=R\sqrt{\theta^2_1\;\boldsymbol{+}\;\theta^2_2\;\mathbf{-}\;2\theta_1\theta_2\cos(\Delta\lambda)},</math>
:where the colatitude values are in radians: <math>\theta=\frac{\pi}{2}-\phi .</math>
:For a latitude measured in degrees, the colatitude in radians may be calculated as follows: <math>\theta=\frac{\pi}{180}(90^\circ-\phi).\,\!</math>

==Spherical-surface formulae==
{{main|Great-circle distance}}
If one is willing to accept a possible error of 0.5%, one can use formulas of [spherical trigonometry](/source/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](/source/great-circle_distance) article gives the formula for calculating the shortest arch length <math>D</math> on a sphere about the size of the Earth. That article includes an example of the calculation. For example, from '''tunnel distance''' <math>D_\textrm{t}</math>, 
:<math>D = 2 R \arcsin \frac{D_\textrm{t}}{2 R}.</math>

For short distances (<math>D\ll R</math>),
:<math>D = D_\textrm{t} \left(1 + \frac{1}{24} \left(\frac{D_\textrm{t}}{R}\right)^2 + \cdots \right).</math>
<!--this underestimates the great circle distance by <math>D(D/R)^2/24</math>.
The tunnel distance between points on the surface of a spherical Earth is
<math>D = R C_h</math>.  -->

===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 <math>D_\textrm{t} =  2 R \sin \frac{D}{2 R}</math> is the great-circle chord length and may be calculated as follows for the corresponding unit sphere:

:<math>\begin{align}
\Delta{X}&=\cos(\phi_2)\cos(\lambda_2) - \cos(\phi_1)\cos(\lambda_1);\\
\Delta{Y}&=\cos(\phi_2)\sin(\lambda_2) - \cos(\phi_1)\sin(\lambda_1);\\
\Delta{Z}&=\sin(\phi_2) - \sin(\phi_1);\\
D_\textrm{t}&=R \sqrt{(\Delta{X})^2 + (\Delta{Y})^2 + (\Delta{Z})^2}\\
&= 2 R \sqrt{\sin^2\frac{\Delta\phi}{2} + \left(\cos^2\frac{\Delta\phi}{2} - \sin^2\phi_\textrm{m}\right) \sin^2\frac{\Delta\lambda}{2}} \\
&= 2 R \sqrt{\left(\sin \frac{\Delta \lambda}{2} \cos\phi_\textrm{m} \right)^2 + \left(\cos \frac{\Delta \lambda}{2} \sin \frac{\Delta \phi}{2} \right)^2}.\end{align}
</math>

==Ellipsoidal-surface formulae==
{{Main|Geodesics on an ellipsoid}}

thumb|
Geodesic on an oblate ellipsoid
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](/source/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](/source/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](/source/Alexis_Claude_Clairaut),<ref>
{{cite journal
|last = Clairaut
|first = A. C.
|date = 1735
|title = Détermination géometrique de la perpendiculaire à la méridienne tracée par M. Cassini
|trans-title = Geometrical determination of the perpendicular to the meridian drawn by Jacques Cassini
|language = fr
|journal = Mémoires de l'Académie Royale des Sciences de Paris 1733
|pages = 406&ndash;416
|url = https://books.google.com/books?id=GOAEAAAAQAAJ&pg=PA406
|author-link = Alexis Claude Clairaut
}}
</ref>
[Legendre](/source/Adrien-Marie_Legendre),<ref>
{{cite journal
|last = Legendre
|first = A. M.
|date = 1806
|title = Analyse des triangles tracées sur la surface d'un sphéroïde
|trans-title = Analysis of spheroidal triangles
|language = fr
|journal = Mémoires de l'Institut National de France
|number = 1st semester
|pages = 130&ndash;161
|url = https://books.google.com/books?id=EnVFAAAAcAAJ&pg=PA130
|author-link = Adrien-Marie Legendre
}}</ref>
[Bessel](/source/Friedrich_Bessel),<ref>
{{cite journal
| ref = {{harvid|Bessel|1825}}
| last1 = Bessel | first1 = F. W.
| author1-link = Friedrich Bessel
| date = 2010
| doi = 10.1002/asna.201011352
| title = The calculation of longitude and latitude from geodesic measurements
| journal = Astronomische Nachrichten
| volume = 331 | issue = 8 | pages = 852&ndash;861
| arxiv = 0908.1824
| orig-year = 1825
| others = . Translated by C. F. F. Karney & R. E. Deakin
| bibcode = 2010AN....331..852K
| s2cid = 118760590 }}</ref>
and [Helmert](/source/Friedrich_Robert_Helmert) English translation of [http://adsabs.harvard.edu/full/1825AN......4..241B ''Astron. Nachr.'' '''4''', 241–254 (1825)]. [https://geographiclib.sourceforge.io/bessel-errata.html Errata].<ref>
{{cite book
|ref = {{harvid|Helmert|1880}}
|last = Helmert
|first = F. R.
|date = 1964
|orig-year = 1880
|title = Mathematical and Physical Theories of Higher Geodesy
|volume = 1
|publisher = Aeronautical Chart and Information Center
|location = St. Louis
|url = https://geographiclib.sourceforge.io/geodesic-papers/helmert80-en.html
|author-link = Friedrich Robert Helmert
}} English translation of [https://books.google.com/books?id=qt2CAAAAIAAJ ''Die Mathematischen und Physikalischen Theorieen der Höheren Geodäsie''], Vol. 1 (Teubner, Leipzig, 1880).</ref>
Rapp<ref>
{{cite tech report
 |first=R. H. |last=Rapp
 |title=Geometric Geodesy, Part II
 |institution=Ohio State University
 |date=March 1993
 |url=http://hdl.handle.net/1811/24409
 |access-date=2011-08-01
}}
</ref>
provides a good summary of this work.

Methods for computing the geodesic distance are widely available in
[geographical information systems](/source/geographical_information_systems), software libraries, standalone
utilities, and online tools.  The most widely used algorithm is by
[Vincenty](/source/Thaddeus_Vincenty),<ref>
{{cite journal
 |first=T. |last=Vincenty |author-link=Thaddeus Vincenty
 |title=Direct and Inverse Solutions of Geodesics on the Ellipsoid with application of nested equations
 |journal=Survey Review
 |volume=23 |issue=176 |date=April 1975 |pages=88&ndash;93
 |doi = 10.1179/sre.1975.23.176.88
 |bibcode=1975SurRv..23...88V |url=http://www.ngs.noaa.gov/PUBS_LIB/inverse.pdf |access-date=2009-07-11
 |postscript = . Addendum: Survey Review '''23''' (180): 294 (1976).
}}</ref>
who uses a series which is accurate to third order in the flattening of
the ellipsoid, i.e., about 0.5&nbsp;mm; however, the algorithm fails to
converge for points that are nearly [antipodal](/source/Antipodes).  (For
details, see [Vincenty's formulae](/source/Vincenty's_formulae).)  This defect is cured in the
algorithm given by
Karney,<ref>
{{Cite journal | last1 = Karney | first1 = C. F. F. | doi = 10.1007/s00190-012-0578-z | title = Algorithms for geodesics | journal = Journal of Geodesy | volume = 87 | pages = 43–55| year = 2013| issue = 1|arxiv = 1109.4448 |bibcode = 2013JGeod..87...43K | s2cid = 119310141 }} – (open access). [https://geographiclib.sourceforge.io/geod-addenda.html Addenda].
</ref>
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.<ref>
{{cite web
|url = https://geographiclib.sourceforge.io
|last = Karney
|first = C. F. F.
|title = GeographicLib
|version = 1.32
|date = 2013
}}
</ref>

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,<ref name=rapp91>
{{cite report
|last = Rapp
|first = R, H
|title = Geometric Geodesy, Part I
|date = 1991
|publisher = Ohio State Univ.
|hdl = 1811/24333
}}</ref> Chap. 6, describes the [Puissant](/source/Louis_Puissant) method,
the Gauss mid-latitude method, and the Bowring method.<ref name=bowring81>
{{cite journal
|last = Bowring
|first = B. R.
|title = The direct and inverse problems for short geodesic lines on the ellipsoid
|journal = Surveying and Mapping
|volume = 41
|number = 2
|date = 1981
|pages = 135&ndash;141
}}
</ref> Karl Hubeny<ref>Hubeny, K. (1954). [https://docplayer.org/80297895-Zur-entwicklung-der-gauss-schen-mitte|Zur Entwicklung der Gauss'schen Mittelbreitenformeln], Österreichische Zeitschrift für Vermessungswesen.</ref> got the expanded series of Gauss mid-latitude one represented as the correction to flat-surface one.

===Andoyer-Lambert formula for long lines===
Historically, the long-line formulae were derived in the form of expansion series with regard to [flattening](/source/flattening) <math>f</math>.<ref>{{cite book
|year = 1927
|last = Forsyth |first = A. R. |author-link = Andrew Forsyth
|title = Calculus of Variations
|publisher = Cambridge Univ. Press
|isbn = 978-1-107-64083-2
|oclc = 250050479
}}</ref><ref>[Henri Andoyer](/source/Marie_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</ref>

Andoyer-Lambert formulae<ref>
{{cite journal
|last = Lambert
|first = W. D
|title = The distance between two widely separated points on the surface of the earth
|journal = J. Washington Academy of Sciences
|date = 1942
|volume = 32
|number = 5
|pages = 125&ndash;130
}}
</ref>
use the first-order correction (Andoyer, 1932) and [reduced latitude](/source/Latitude), <math> \beta = \arctan \left( (1 - f) \tan \phi \right)</math>, for better accuracy. They give accuracy on the order of 10 meters over thousands of kilometers.

First convert the latitudes <math> \scriptstyle \phi_1</math>, <math> \scriptstyle \phi_2</math> of the two points to [reduced latitudes](/source/Latitude) <math> \scriptstyle \beta_1</math>,  <math> \scriptstyle  \beta_2</math>.
Then calculate the [central angle](/source/central_angle) <math> \sigma</math> in radians between two points <math> (\beta_1 , \; \lambda_1)</math> and <math> (\beta_2 , \; \lambda_2)</math> on a sphere using [the Great-circle distance method](/source/Great-circle_distance) (<!--[law of cosines](/source/spherical_law_of_cosines) or -->[haversine formula](/source/haversine_formula)), with longitudes <math> \lambda_1 \; </math> and <math> \lambda_2 \; </math> being the same on the sphere as on the spheroid.

:<math>P = \frac { \beta_1 + \beta_2 }{2} \qquad Q = \frac {\beta_2 - \beta_1}{2}</math>

:<math>X = ( \sigma - \sin \sigma) \frac {\sin^2 P \cos^2 Q}{ \cos^2 \frac { \sigma}{2}} \qquad \qquad Y = ( \sigma + \sin \sigma) \frac {\cos^2 P \sin^2 Q}{ \sin^2 \frac { \sigma}{2}}</math>

:<math display="inline">D = a \bigl( \sigma - \tfrac f2 (X + Y) \bigr) </math>,

where <math>a</math> is the equatorial radius of the chosen spheroid.

On the [GRS 80](/source/GRS_80) spheroid Lambert's formula is off by

:0 North 0 West to 40 North 120 West, 12.6 meters
:0N 0W to 40N 60W, 6.6 meters
:40N 0W to 40N 60W, 0.85 meter

===Gauss mid-latitude method for short lines===
It has the similar form of the arc length converted from tunnel distance. Detailed formulas are given by Rapp,<ref name=rapp91/> §6.4. It is consistent with the above-mentioned flat-surface formulae apparently.

: <math>D = 2 N\left(\phi_\textrm{m}\right) \arcsin \sqrt{\left(\sin \frac{\Delta \lambda}{2} \cos\phi_\textrm{m} \right)^2 + \left(\cos \frac{\Delta \lambda}{2} \sin \left(\frac{\Delta \phi}{2} \frac{M\left(\phi_\textrm{m}\right)}{N\left(\phi_\textrm{m}\right)}\right) \right)^2}.</math>
<!--Note that <math>\arcsin x \approx x</math> and <math>\sin \left(\frac{\Delta \phi}{2} \frac{M\left(\phi_\textrm{m}\right)}{N\left(\phi_\textrm{m}\right)}\right) \approx \frac{\Delta \phi}{2} \frac{M\left(\phi_\textrm{m}\right)}{N\left(\phi_\textrm{m}\right)}</math> under the condition of quite short lines.-->

===Bowring's method for short lines===
Bowring maps the points to a sphere of radius ''R&prime;'', with latitude and longitude represented as φ&prime; and λ&prime;.  Define
:<math>A = \sqrt{1 + e'^2\cos^4 \phi_1}, \quad B = \sqrt{1 + e'^2\cos^2 \phi_1},</math>
where the second eccentricity squared is
:<math> e'^2 = \frac{a^2 - b^2}{b^2} = \frac{f(2-f)}{(1-f)^2}.</math>
The spherical radius is
:<math>R' = \frac{\sqrt{1 + e'^2 }}{B^2} a.</math>
(The [Gaussian curvature](/source/Gaussian_curvature) of the ellipsoid at φ<sub>1</sub> is 1/''R&prime;''<sup>2</sup>.)
The spherical coordinates are given by
:<math>\begin{align}
\tan\phi_1' &= \frac{\tan\phi_1}B,\\
\Delta\phi' &=  \frac{\Delta \phi}{B}\biggl[1 + \frac{3 e'^2 }{4 B^2}(\Delta \phi) \sin (2 \phi_1 + \tfrac23 \Delta \phi )\biggr],\\
\Delta\lambda' &= A\Delta\lambda,
\end{align}
</math>
where <math>\Delta\phi=\phi_2-\phi_1</math>, <math>\Delta\phi'=\phi_2'-\phi_1'</math>,
<math>\Delta\lambda=\lambda_2-\lambda_1</math>, <math>\Delta\lambda'=\lambda_2'-\lambda_1'</math>.  The resulting problem on the sphere may be solved using the techniques for [great-circle navigation](/source/great-circle_navigation) to give approximations for the spheroidal distance and bearing. Detailed formulas are given by Rapp<ref name=rapp91/> §6.5 and Bowring.<ref name=bowring81/> The use of mid-latitude, <math>\phi_\textrm{m}</math>, improves the accuracy, shown by Karney.<ref>{{Cite web |title=GeographicLib: Geodesics on an ellipsoid of revolution |url=https://geographiclib.sourceforge.io/C++/doc/geodesic.html#geodshort |access-date=2024-08-04 |website=geographiclib.sourceforge.io |language=en-US}}</ref>

== Altitude correction ==
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.<ref>{{cite web |url=http://www.tech.mtu.edu/courses/su3150/Reference%20Material/Vincenty.pdf |title=Archived copy |access-date=2014-08-26 |url-status=dead |archive-url=https://web.archive.org/web/20140827072956/http://www.tech.mtu.edu/courses/su3150/Reference%20Material/Vincenty.pdf |archive-date=2014-08-27 }}</ref>
The slant distance ''s'' ([chord](/source/chord_(geometry)) length) between two points can be reduced to the [arc length](/source/arc_length) on the ellipsoid surface ''S'' as:<ref name="T&G">Torge & Müller (2012) Geodesy, De Gruyter, p.249</ref>
:<math>S-s=-0.5(h_1+h_2)s/R-0.5(h_1-h_2)^2/s</math>
where ''R'' is evaluated from Earth's [azimuthal radius of curvature](/source/azimuthal_radius_of_curvature) and ''h'' are [ellipsoidal height](/source/ellipsoidal_height)s are each point. 
The first term on the right-hand side of the equation accounts for the mean elevation and the second term for the inclination.
A further reduction of the above [Earth normal section](/source/Earth_normal_section) length to the [ellipsoidal geodesic](/source/ellipsoidal_geodesic) length is often negligible.<ref name="T&G"/>

==See also==
*[Arc measurement](/source/Arc_measurement)
*[Earth radius](/source/Earth_radius)
*[Spherical Earth](/source/Spherical_Earth)
*[Great-circle distance](/source/Great-circle_distance)
*[Great-circle navigation](/source/Great-circle_navigation)
*[Ground sample distance](/source/Ground_sample_distance)
*[Vincenty's formulae](/source/Vincenty's_formulae)
*[Meridian arc](/source/Meridian_arc)
*[Scale (map)](/source/Scale_(map))
<!--==Notes==
{{reflist|group=nb}}-->

==References==
{{Reflist}}

==External links==
*An [https://geographiclib.sourceforge.io/cgi-bin/GeodSolve online geodesic calculator] (based on GeographicLib).
*An [https://geographiclib.sourceforge.io/geodesic-papers/biblio.html online geodesic bibliography].

Category:Cartography
Category:Earth
Category:Geodesy

---
Adapted from the Wikipedia article [Geographical distance](https://en.wikipedia.org/wiki/Geographical_distance) by Wikipedia contributors ([contributor history](https://en.wikipedia.org/wiki/Geographical_distance?action=history)). Available under [Creative Commons Attribution-ShareAlike 4.0 International](https://creativecommons.org/licenses/by-sa/4.0/). Changes may have been made.
