Great-circle distance: Difference between revisions
JeremyCole (talk | contribs) No edit summary |
Tags: Mobile edit Mobile app edit Android app edit App select source |
||
(721 intermediate revisions by more than 100 users not shown) | |||
Line 1: | Line 1: | ||
{{Short description|Shortest distance between two points on the surface of a sphere}}{{About|shortest-distance on a sphere|the shortest distance on an ellipsoid|geodesics on an ellipsoid}} |
|||
"Great circle distance" is the distance between any two points on a sphere. |
|||
[[File:Illustration of great-circle distance.svg|thumb|A diagram illustrating great-circle distance (drawn in red) between two points on a sphere, P and Q. Two [[antipodal points]], u and v are also shown.]] |
|||
It is commonly used to find the distance (e.g. in miles) between two coordinates (latitude/longitude pairs) on a map. |
|||
The '''great-circle distance''', '''orthodromic distance''', or '''spherical distance''' is the [[distance]] between two [[point (geometry)|points]] on a [[sphere]], measured along the [[great circle|great-circle]] arc between them. This arc is the shortest path between the two points on the surface of the sphere. (By comparison, the shortest path passing through the sphere's interior is the [[chord (geometry)|chord]] between the points.) |
|||
latitude is <math>\delta</math> |
|||
longitude is <math>\lambda</math> |
|||
On a [[manifold|curved surface]], the concept of [[straight line]]s is replaced by a more general concept of [[geodesic]]s, curves which are locally straight with respect to the surface. Geodesics on the sphere are great circles, circles whose center coincides with the center of the sphere. |
|||
The formula is: |
|||
Any two distinct points on a sphere that are not [[antipodal point|antipodal]] (diametrically opposite) both lie on a unique great circle, which the points separate into two arcs; the length of the shorter arc is the great-circle distance between the points. This arc length is proportional to the [[central angle]] between the points, which if measured in [[radian]]s can be scaled up by the sphere's [[radius]] to obtain the arc length. Two antipodal points both lie on infinitely many great circles, each of which they divide into two arcs of length [[pi|{{math|π}}]] times the radius. |
|||
:<math>\capdelta = \lambda' - \lambda</math> |
|||
:<math>dlat = \delta' - \delta</math> |
|||
The determination of the great-circle distance is part of the more general problem of [[great-circle navigation]], which also computes the [[azimuth]]s at the end points and intermediate way-points. Because the Earth [[Spherical Earth|is nearly spherical]], great-circle distance formulas applied to longitude and [[geodetic latitude]] of points on Earth are accurate to within about 0.5%.<ref>{{citation |title=Admiralty Manual of Navigation, Volume 1 |publisher=The Stationery Office |year=1987 |isbn=9780117728806 |page=10 |url=https://books.google.com/books?id=xcy4K5BPyg4C&pg=PA10 |quotation=The errors introduced by assuming a spherical Earth based on the international nautical mile are not more than 0.5% for latitude, 0.2% for longitude.}}</ref> |
|||
:<math>a = (\sin{(\frac{dlat}{2})})^2 + \cos{\delta} * \cos{\delta'} * (\sin{(\frac{dlon}{2})})^2</math> |
|||
:<math>c = 2 * \arcsin{(\min{(1,\sqrt{a})})}</math> |
|||
== Formulae == |
|||
:<math>d = R * c</math> |
|||
[[File:Central angle.svg|thumb|An illustration of the central angle, Δσ, between two points, P and Q. λ and φ are the longitudinal and latitudinal angles of P respectively]] |
|||
Let <math>\lambda_1, \phi_1</math> and <math>\lambda_2, \phi_2</math> be the geographical [[longitude]] and [[latitude]] of two points 1 and 2, and <math>\Delta\lambda, \Delta\phi</math> be their absolute differences; then <math>\Delta\sigma</math>, the [[central angle]] between them, is given by the [[spherical law of cosines]] if one of the poles is used as an auxiliary third point on the sphere:<ref>{{cite book |last1=Kells |first1=Lyman M. |last2=Kern |first2=Willis F. |last3=Bland |first3=James R. |title=Plane And Spherical Trigonometry |url=https://archive.org/details/planeandspherica031803mbp |access-date=July 13, 2018 |year=1940 |publisher=McGraw Hill Book Company, Inc. |pages=[https://archive.org/details/planeandspherica031803mbp/page/n344 323]-326 }}</ref> |
|||
:<math>\Delta\sigma = \arccos\bigl(\sin\phi_1\sin\phi_2 + \cos\phi_1\cos\phi_2\cos\Delta\lambda\bigr).</math> |
|||
The problem is normally expressed in terms of finding the central angle <math>\Delta\sigma</math>. Given this angle in radians, the actual [[arc length]] ''d'' on a sphere of radius ''r'' can be trivially computed as |
|||
:<math>d = r \, \Delta\sigma.</math> |
|||
== Relation between central angle and chord length == |
|||
The central angle <math>\Delta\sigma</math> is related with the [[Chord (geometry)|chord]] length of unit sphere <math>\Delta\sigma_\text{c}\,\!</math>: |
|||
:<math>\begin{align} |
|||
\Delta\sigma &= 2\arcsin \frac{\Delta\sigma_\text{c}}{2} ,\\ |
|||
\Delta\sigma_\text{c} &= 2\sin \frac{\Delta\sigma}{2} . |
|||
\end{align}</math> |
|||
For short-distance approximation (<math>|\Delta\sigma_\text{c}| \ll 1</math>), |
|||
:<math>\Delta\sigma = \Delta\sigma_\text{c} \left(1 + \frac{1}{24} \left(\Delta\sigma_\text{c}\right)^2 + \cdots \right).</math> |
|||
===Computational formulae=== |
|||
On computer systems with low [[floating point]] precision, the spherical law of cosines formula can have large [[rounding error]]s if the distance is small (if the two points are a kilometer apart on the surface of the Earth, the cosine of the central angle is near 0.99999999). For modern [[IEEE 754|64-bit floating-point numbers]], the spherical law of cosines formula, given above, does not have serious rounding errors for distances larger than a few meters on the surface of the Earth.<ref>{{cite web |url=http://www.movable-type.co.uk/scripts/latlong.html |title=Calculate distance, bearing and more between Latitude/Longitude points |access-date=10 Aug 2013}}</ref> The [[haversine formula]] is [[condition number|numerically better-conditioned]] for small distances by using the chord-length relation:<ref>{{cite journal |last1=Sinnott |first1=Roger W. |title=Virtues of the Haversine |journal=Sky and Telescope |date=August 1984 |volume=68 |issue=2 |page=159}}</ref> |
|||
:<math>\begin{align} |
|||
\Delta\sigma &= \operatorname{archav}\left( \operatorname{hav}\left(\Delta\phi\right) + \left(1 - \operatorname{hav}(\Delta\phi) - \operatorname{hav}(\phi_1 + \phi_2)\right) \operatorname{hav}\left(\Delta\lambda\right)\right) . |
|||
\end{align}</math> |
|||
Historically, the use of this formula was simplified by the availability of tables for the [[haversine]] function: <math>\operatorname{hav} \theta = \sin^2 \frac{\theta}{2}</math> and <math>\operatorname{archav} x = 2 \arcsin \sqrt{x}</math>. |
|||
The following shows the equivalent formula expressing the chord length explicitly: |
|||
:<math>\begin{align}\Delta\sigma_\text{c}&=2\sqrt{\sin^2\left(\frac{\Delta\phi}{2}\right)+\cos{\phi_1}\cdot\cos{\phi_2}\cdot\sin^2\left(\frac{\Delta\lambda}{2}\right)} \ , \\ |
|||
&=2\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> |
|||
where <math>\phi_\text{m}=\tfrac12(\phi_1+\phi_2)</math>. |
|||
Although this formula is accurate for most distances on a sphere, it too suffers from rounding errors for the special (and somewhat unusual) case of antipodal points. A formula that is accurate for all distances is the following special case of the [[Vincenty's formulae|Vincenty formula]] for an ellipsoid with equal major and minor axes:<ref>{{cite journal |last = Vincenty |first = Thaddeus |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 |pages = 88–93 |publisher = [[Directorate of Overseas Surveys]] |location = Kingston Road, Tolworth, Surrey |date = 1975-04-01 |url =http://www.ngs.noaa.gov/PUBS_LIB/inverse.pdf |access-date = 2008-07-21 |doi = 10.1179/sre.1975.23.176.88}}</ref> |
|||
:<math>\begin{align} |
|||
\Delta\sigma = {\operatorname{atan2}} \Bigl( &\sqrt{\left( |
|||
\cos\phi_2\sin\Delta\lambda\right)^2 + |
|||
\left(\cos\phi_1\sin\phi_2 - \sin\phi_1\cos\phi_2\cos\Delta\lambda |
|||
\right)^2}, \\ |
|||
&\quad {\sin\phi_1\sin\phi_2 + \cos\phi_1\cos\phi_2\cos\Delta\lambda} \Bigr), |
|||
\end{align}</math> |
|||
where {{tmath|\operatorname{atan2}(y, x)}} is the [[atan2|two-argument arctangent]]. Using atan2 ensures that the correct quadrant is chosen. |
|||
=== Vector version === |
|||
Another representation of similar formulas, but using [[n-vector|normal vectors]] instead of latitude and longitude to describe the positions, is found by means of 3D [[Vector calculus#Vector operations|vector algebra]], using the [[dot product]], [[cross product]], or a combination:<ref>{{cite journal |last1= Gade |first1= Kenneth |year= 2010 |title= A non-singular horizontal position representation |journal= The Journal of Navigation |publisher= Cambridge University Press |volume= 63 |issue= 3 |pages=395–417 |url=http://www.navlab.net/Publications/A_Nonsingular_Horizontal_Position_Representation.pdf |doi= 10.1017/S0373463309990415 }}</ref> |
|||
:<math>\begin{align} |
|||
\Delta\sigma &= \arccos \left(\mathbf n_1 \cdot \mathbf n_2\right) \\ |
|||
&= \arcsin \left| \mathbf n_1 \times \mathbf n_2 \right| \\ |
|||
&= \arctan \frac{\left| \mathbf n_1 \times \mathbf n_2 \right|}{\mathbf n_1 \cdot \mathbf n_2} \\ |
|||
\end{align}</math> |
|||
where <math>\mathbf n_1</math> and <math>\mathbf n_2</math> are the normals to the sphere at the two positions 1 and 2. Similarly to the equations above based on latitude and longitude, the expression based on arctan is the only one that is [[Inverse trigonometric functions#Numerical accuracy|well-conditioned for all angles]]. The expression based on arctan requires the magnitude of the cross product over the dot product. |
|||
=== From chord length === |
|||
A line through three-dimensional space between points of interest on a [[spherical Earth]] is the [[Chord (geometry)|chord]] of the great circle between the points. The [[central angle]] between the two points can be determined from the chord length. The great circle distance is proportional to the central angle. |
|||
The great circle chord length, <math>\Delta\sigma_\text{c}\,\!</math>, may be calculated as follows for the corresponding unit sphere, by means of [[Cartesian coordinate system|Cartesian subtraction]]: |
|||
:<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;\\ |
|||
\Delta\sigma_\text{c} &= \sqrt{(\Delta{X})^2 + (\Delta{Y})^2 + (\Delta{Z})^2}. |
|||
\end{align}</math> |
|||
Substituting <math>\lambda_1 = -\tfrac12\Delta \lambda </math> and <math>\lambda_2 = \tfrac12 \Delta \lambda</math> this formula can be algebraically manipulated to the form shown above in {{slink||Computational formulae}}. |
|||
==Radius for spherical Earth== |
|||
[[File:WGS84_mean_Earth_radius.svg|thumb|Equatorial (''a''), polar (''b'') and mean Earth radii as defined in the 1984 [[World Geodetic System]] revision. (''Not to scale''.)]] |
|||
{{main|Earth radius}} |
|||
The [[Geoid|shape of the Earth]] closely resembles a flattened sphere (a [[spheroid]]) with equatorial radius <math>a</math> of 6378.137 km; distance <math>b</math> from the center of the spheroid to each pole is 6356.7523142 km. When calculating the length of a short north-south line at the equator, the circle that best approximates that line has a radius of <math display="inline">\frac{b^2}{a}</math> (which equals the meridian's [[Conic section#Features|semi-latus rectum]]), or 6335.439 km, while the spheroid at the poles is best approximated by a sphere of radius <math display="inline">\frac{a^2}{b}</math>, or 6399.594 km, a 1% difference. So long as a spherical Earth is assumed, any single formula for distance on the Earth is only guaranteed correct within 0.5% (though better accuracy is possible if the formula is only intended to apply to a limited area). Using the [[Earth radius#Arithmetic mean radius|mean Earth radius]], <math display="inline">R_1 = \frac{1}{3}(2a + b) \approx 6371.009\text{ km}</math> (for the [[WGS84]] ellipsoid) means that in the limit of small flattening, the mean square [[Relative error#Definitions|relative error]] in the estimates for distance is minimized.<ref name=mccaw32> |
|||
{{cite journal |last = McCaw |first = G. T. |title = Long lines on the Earth |journal = Empire Survey Review |volume = 1 |number = 6 |pages = 259–263 |doi = 10.1179/sre.1932.1.6.259 |year = 1932}}</ref> |
|||
For distances smaller than 500 kilometers and outside of the poles, a Euclidean approximation of an ellipsoidal Earth ([[Geographical_distance#FCC's formula|Federal Communications Commission's (FCC)'s formula]]) is both simpler and more accurate (to 0.1%).<ref>{{multiref|1={{cite web |first1=Vladimir|last1=Agafonkin|title=Fast geodesic approximations with Cheap Ruler |url=https://blog.mapbox.com/fast-geodesic-approximations-with-cheap-ruler-106f229ad016 |website=Mapbox |language=en |date=30 August 2017}}|2={{cite web |title=mapbox/cheap-ruler |url=https://github.com/mapbox/cheap-ruler |publisher=Mapbox |date=10 May 2024}}}}</ref> |
|||
{{clear}} |
|||
==See also== |
|||
{{Div col|colwidth=25em}} |
|||
* [[Air navigation]] |
|||
* [[Angular distance]] |
|||
* [[Circumnavigation]] |
|||
* {{section link|Elliptic geometry#Elliptic space (the 3D case)}} |
|||
* [[Flight planning]] |
|||
* [[Geodesy]] |
|||
* [[Geodesics on an ellipsoid]] |
|||
* [[Geodetic system]] |
|||
* [[Geographical distance]] |
|||
* [[Isoazimuthal]] |
|||
* [[Loxodromic navigation]] |
|||
* [[Meridian arc]] |
|||
* [[Rhumb line]] |
|||
* [[Spherical geometry]] |
|||
* [[Spherical trigonometry]] |
|||
* [[Versor]] |
|||
{{Div col end}} |
|||
==References and notes== |
|||
{{Reflist}} |
|||
==External links== |
|||
* [http://mathworld.wolfram.com/GreatCircle.html GreatCircle] at [[MathWorld]] |
|||
{{DEFAULTSORT:Great-Circle Distance}} |
|||
[[Category:Metric geometry]] |
|||
[[Category:Spherical trigonometry]] |
|||
[[Category:Distance]] |
|||
[[Category:Spherical curves]] |
Latest revision as of 01:20, 11 December 2024
The great-circle distance, orthodromic distance, or spherical distance is the distance between two points on a sphere, measured along the great-circle arc between them. This arc is the shortest path between the two points on the surface of the sphere. (By comparison, the shortest path passing through the sphere's interior is the chord between the points.)
On a curved surface, the concept of straight lines is replaced by a more general concept of geodesics, curves which are locally straight with respect to the surface. Geodesics on the sphere are great circles, circles whose center coincides with the center of the sphere.
Any two distinct points on a sphere that are not antipodal (diametrically opposite) both lie on a unique great circle, which the points separate into two arcs; the length of the shorter arc is the great-circle distance between the points. This arc length is proportional to the central angle between the points, which if measured in radians can be scaled up by the sphere's radius to obtain the arc length. Two antipodal points both lie on infinitely many great circles, each of which they divide into two arcs of length π times the radius.
The determination of the great-circle distance is part of the more general problem of great-circle navigation, which also computes the azimuths at the end points and intermediate way-points. Because the Earth is nearly spherical, great-circle distance formulas applied to longitude and geodetic latitude of points on Earth are accurate to within about 0.5%.[1]
Formulae
[edit]Let and be the geographical longitude and latitude of two points 1 and 2, and be their absolute differences; then , the central angle between them, is given by the spherical law of cosines if one of the poles is used as an auxiliary third point on the sphere:[2]
The problem is normally expressed in terms of finding the central angle . Given this angle in radians, the actual arc length d on a sphere of radius r can be trivially computed as
Relation between central angle and chord length
[edit]The central angle is related with the chord length of unit sphere :
For short-distance approximation (),
Computational formulae
[edit]On computer systems with low floating point precision, the spherical law of cosines formula can have large rounding errors if the distance is small (if the two points are a kilometer apart on the surface of the Earth, the cosine of the central angle is near 0.99999999). For modern 64-bit floating-point numbers, the spherical law of cosines formula, given above, does not have serious rounding errors for distances larger than a few meters on the surface of the Earth.[3] The haversine formula is numerically better-conditioned for small distances by using the chord-length relation:[4]
Historically, the use of this formula was simplified by the availability of tables for the haversine function: and .
The following shows the equivalent formula expressing the chord length explicitly:
where .
Although this formula is accurate for most distances on a sphere, it too suffers from rounding errors for the special (and somewhat unusual) case of antipodal points. A formula that is accurate for all distances is the following special case of the Vincenty formula for an ellipsoid with equal major and minor axes:[5]
where is the two-argument arctangent. Using atan2 ensures that the correct quadrant is chosen.
Vector version
[edit]Another representation of similar formulas, but using normal vectors instead of latitude and longitude to describe the positions, is found by means of 3D vector algebra, using the dot product, cross product, or a combination:[6]
where and are the normals to the sphere at the two positions 1 and 2. Similarly to the equations above based on latitude and longitude, the expression based on arctan is the only one that is well-conditioned for all angles. The expression based on arctan requires the magnitude of the cross product over the dot product.
From chord length
[edit]A line through three-dimensional space between points of interest on a spherical Earth is the chord of the great circle between the points. The central angle between the two points can be determined from the chord length. The great circle distance is proportional to the central angle.
The great circle chord length, , may be calculated as follows for the corresponding unit sphere, by means of Cartesian subtraction:
Substituting and this formula can be algebraically manipulated to the form shown above in § Computational formulae.
Radius for spherical Earth
[edit]The shape of the Earth closely resembles a flattened sphere (a spheroid) with equatorial radius of 6378.137 km; distance from the center of the spheroid to each pole is 6356.7523142 km. When calculating the length of a short north-south line at the equator, the circle that best approximates that line has a radius of (which equals the meridian's semi-latus rectum), or 6335.439 km, while the spheroid at the poles is best approximated by a sphere of radius , or 6399.594 km, a 1% difference. So long as a spherical Earth is assumed, any single formula for distance on the Earth is only guaranteed correct within 0.5% (though better accuracy is possible if the formula is only intended to apply to a limited area). Using the mean Earth radius, (for the WGS84 ellipsoid) means that in the limit of small flattening, the mean square relative error in the estimates for distance is minimized.[7]
For distances smaller than 500 kilometers and outside of the poles, a Euclidean approximation of an ellipsoidal Earth (Federal Communications Commission's (FCC)'s formula) is both simpler and more accurate (to 0.1%).[8]
See also
[edit]References and notes
[edit]- ^ Admiralty Manual of Navigation, Volume 1, The Stationery Office, 1987, p. 10, ISBN 9780117728806,
The errors introduced by assuming a spherical Earth based on the international nautical mile are not more than 0.5% for latitude, 0.2% for longitude.
- ^ Kells, Lyman M.; Kern, Willis F.; Bland, James R. (1940). Plane And Spherical Trigonometry. McGraw Hill Book Company, Inc. pp. 323-326. Retrieved July 13, 2018.
- ^ "Calculate distance, bearing and more between Latitude/Longitude points". Retrieved 10 Aug 2013.
- ^ Sinnott, Roger W. (August 1984). "Virtues of the Haversine". Sky and Telescope. 68 (2): 159.
- ^ Vincenty, Thaddeus (1975-04-01). "Direct and Inverse Solutions of Geodesics on the Ellipsoid with Application of Nested Equations" (PDF). Survey Review. 23 (176). Kingston Road, Tolworth, Surrey: Directorate of Overseas Surveys: 88–93. doi:10.1179/sre.1975.23.176.88. Retrieved 2008-07-21.
- ^ Gade, Kenneth (2010). "A non-singular horizontal position representation" (PDF). The Journal of Navigation. 63 (3). Cambridge University Press: 395–417. doi:10.1017/S0373463309990415.
- ^ McCaw, G. T. (1932). "Long lines on the Earth". Empire Survey Review. 1 (6): 259–263. doi:10.1179/sre.1932.1.6.259.
- ^
- Agafonkin, Vladimir (30 August 2017). "Fast geodesic approximations with Cheap Ruler". Mapbox.
- "mapbox/cheap-ruler". Mapbox. 10 May 2024.