Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Great-circle distance
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===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|bibcode = 1975SurRv..23...88V }}</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.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)