| Version 17 (modified by karney, 4 years ago) |
|---|
Geodestic Calculations
Geodestic calculations are calculations along lines (great circle) on the surface of the earth. They can answer questions like:
- What is the distance between these two points?
- If I travel X meters from point A at bearing phi, where will I be.
They are done in native lat-long coordinates, rather than in projected coordinates.
Mailing list threads
- http://thread.gmane.org/gmane.comp.gis.proj-4.devel/3361
- http://thread.gmane.org/gmane.comp.gis.proj-4.devel/3375
- http://thread.gmane.org/gmane.comp.gis.proj-4.devel/3435
- http://thread.gmane.org/gmane.comp.gis.proj-4.devel/3588
- http://thread.gmane.org/gmane.comp.gis.proj-4.devel/3925
- http://thread.gmane.org/gmane.comp.gis.proj-4.devel/4047
- http://thread.gmane.org/gmane.comp.gis.proj-4.devel/4083
Terminology
The shortest distance on the surface of a solid is generally termed a geodesic, be it an ellipsoid of revolution, aposphere, etc. On a sphere, the geodesic is termed a Great Circle.
HOWEVER, when computing the distance between two points using a projected coordinate system, that is a conformal projection such as Transverse Mercator, Oblique Mercator, Normal Mercator, Stereographic, or Lambert Conformal Conic - that then is a GRID distance which can be converted to an equivalent GEODETIC distance using the function for "Scale Factor at a Point." The conversion is then termed "Grid Distance to Geodetic Distance," even though it will not be as exactly correct as a true ellipsoidal geodesic. Closer to the truth with a TM than with a Lambert or other conformal projection, but still not exactly "on."
So, it can be termed "geodetic distance" or a "geodesic distance," depending on just how you got there ...
The Math
Spheroidal Approximation
The simplest way to compute geodesics is using a sphere as an approximation for the earth. This from Mikael Rittri on the Proj mailing list:
If 1 percent accuracy is enough, I think you can use spherical formulas with a fixed Earth radius. You can find good formulas in the Aviation Formulary of Ed Williams, http://williams.best.vwh.net/avform.htm.
For the fixed Earth radius, I would choose the average of the:
c = radius of curvature at the poles,
b2 / a = radius of curvature in a meridian plane at the equator,
since these are the extreme values for the local radius of curvature of the earth ellipsoid.
If your coordinates are given in WGS84, then
c = 6 399 593.626 m,
b2 / a = 6 335 439.327 m,
(see http://home.online.no/~sigurdhu/WGS84_Eng.html) so their average is 6,367,516.477 m. The maximal error for distance calculation should then be less than 0.51 percent.
When computing the azimuth between two points by the spherical formulas, I think the maximal error on WGS84 will be 0.2 degrees, at least if the points are not too far away (less than 1000 km apart, say). The error should be maximal near the equator, for azimuths near northeast etc.
I am not sure about the spherical errors for the forward geodetic problem: point positioning given initial point, distance and azimuth.
Ellipsoidal Approximation
For more accuracy, the earth can be approximated with an ellipsoid, complicating the math somewhat.
Thaddeus Vincenty's method, April 1975
For a very good procedure to calculate inter point distances see:
http://www.ngs.noaa.gov/PC_PROD/Inv_Fwd/ (Fortan code, DOS executables, and an online app)
and algorithm details published in:
Javascript code
Chris Veness has coded Vincenty's formulas as JavaScript.
distance: http://www.movable-type.co.uk/scripts/latlong-vincenty.html
direct: http://www.movable-type.co.uk/scripts/latlong-vincenty-direct.html
C code
From Gerald Evenden: a library of the converted NGS Vincenty geodesic procedure and an application program, 'geodesic'. In the case of a spherical earth Snyder's preferred equations are used.
Earlier Mr. Evenden had posted to the PROJ.4 mailing list this code for determination of true distance and respective forward and back azimuths between two points on the ellipsoid. Good for any pair of points that are not antipodal. Later he posted that this was not in fact the translation of NGS FORTRAN code, but something else. But, for what it's worth, here is the posted code (source unknown):
PROJ.4 - geod program
The PROJ.4 geod program can be used for great circle distances on an ellipsoid. Currently the underlying geodesic calculation API is not exposed as part of the PROJ.4 library. Gerald writes that geod is based upon a poorer algorithm (than the NGS procedure above) and he no longer supports it. But it is probably good enough for most applications. The method is documented here:
Paul D. Thomas, 1970
"Spheroidal Geodesics, Reference Systems, and
Local Geometry"
U.S. Naval Oceanographic Office, p. 162
Engineering Library 526.3 T36s
http://stinet.dtic.mil/oai/oai?&verb=getRecord&metadataPrefix=html&identifier=AD0703541
GeographicLib::Geodesic
Charles Karney has written a C++ class to do geodesic calculations and a utility Geod to call it. See
This is an attempt to do geodesic calculations "right", i.e.,
- Accurate to round-off (i.e., about 15 nm);
- Inverse solution always succeeds (even for near anti-podal points).
In addition, this class computes Christoffel's "reduced length", which gives the azimuthal scale for the corresponding azimuthal equidistant projection. This class is largely based on the work of Bessel (1826) and Helmert (1880) with the series approximations extended with Maxima.
The History
Here is a list of the older mathematical treatments of the geodesic problem for an ellipsoid, together with links to online copies. Unfortunately, the book scanning done by Google does not fold out the folded figures. I (Charles Karney) will upload scans of the missing figures I can get hold of. Please let me know of errors, omissions, etc.
- A. C. Clairaut,
Détermination géometrique de la perpendiculaire a la méridienne tracée par M. Cassini,
Mém. de l'Acad. Roy. des Sciences de Paris, 406-416 (1733, publ. 1735).
http://gallica.bnf.fr/ark:/12148/bpt6k3530m - A. C. Clairaut,
Suite d'un Mémoire donné en 1733, qui a pour titre: Détermination géometrique de la perpendiculaire a la méridienne tracée, &c,
Mém. de l'Acad. Roy. des Sciences de Paris, 83-96 (1739, publ. 1741).
http://gallica.bnf.fr/ark:/12148/bpt6k3536g - L. Euler,
Principes de la trigonométrie sphérique tirés de la méthode des plus grands et plus petits,
Mém. de l'Acad. Roy. des Sciences de Berlin 9, 223-257 (1753, publ. 1755).
http://math.dartmouth.edu/~euler/pages/E214.html - L. Euler,
Élémens de la trigonométrie sphéroïdique tirés de la méthode des plus grands et plus petits,
Mem. de l'Acad. Roy. des Sciences de Berlin 9, 258-293 (1753, publ. 1755).
http://math.dartmouth.edu/~euler/pages/E215.html - A. P. Dionis du Séjour,
Traité Analytique des Mouvemens apparens des Corps Célestes, Vol. 2 (Veuve Valade, Paris, 1789), Book 1, Chaps. 1-2.
http://books.google.com/books?id=SzEVAAAAQAAJ - A. M. Legendre,
Mémoire sur les opérations trigonométriques, dont les résultats dépendent de la figure de la terre,
Mém. de l'Acad. Roy. des Sciences de Paris, 352-383 (1787, publ. 1789).
http://books.google.com/books?id=0uIEAAAAQAAJ - A. M. Legendre,
Analyse des triangles tracés sur la surface d'un sphéroïde,
Mém. de l'Inst. Nat. de France, 130-161 (1806).
http://books.google.com/books?id=-d0EAAAAQAAJ - A. M. Legendre,
Exercices de Calcul Intégral sur Divers Ordres de Transcendantes et sur les Quadratures, Vol. 1 (Courcier, Paris, 1811).
http://www.archive.org/details/exercicescalculi01legerich - L. Puissant,
Traité de Géodésie ou Exposition des Méthodes Trigonométriques et Astronomiques, Vol 2 (2nd Edition, Courcier, Paris, 1819), Book 6, Chap 1.
http://books.google.com/books?id=PZEAAAAAMAAJ - F. W. Bessel,
Ueber die Berechnung der geographischen Längen und Breiten aus geodätischen Vermessungen,
Astron. Nachr. 4 (86), 241-254 (1826).
http://adsabs.harvard.edu/abs/1826AN......4..241B - F. W. Bessel,
Abhandlungen von Friedrich Wilhelm Bessel, Vol. 3 (W. Engelmann, Leipzig, 1876), Part 6.
http://books.google.com/books?id=vX4EAAAAYAAJ - C. F. Gauss,
General Investigations of Curved Surfaces of 1827 and 1825,
Translation by J. C. Morehead and A. M. Hiltebeitel of Disquisitiones generales circa superficies curvas (Princeton Univ. Lib., 1902).
http://books.google.com/books?id=a1wTJR3kHwUC - E. B. Christoffel,
Allgemeine Theorie der geodätischen Dreiecke,
Math. Abhand. König. Akad. der Wiss. zu Berlin 8, 119-176 (1868),
in Gesammelte Mathematische Abhandlungen, Vol. 1, Chap. 16, pp. 297-346 (Teubner, Leipzig, 1910).
http://books.google.com/books?id=9W9tAAAAMAAJ - A. Cayley,
On the geodesic lines on an oblate spheroid,
Phil. Mag. 40, 329-340 (1870),
in The Collected Mathematical Papers of Arthur Cayley, Vol 7 (Cambridge Univ. Press, 1894), paper 422, pp 15-25.
http://www.archive.org/details/collectedmathema07cayluoft - F. R. Helmert,
Die Mathematischen und Physikalischen Theorieen der Höheren Geodäsie, Vol. 1 (Teubner, Leipzig, 1880), Chaps. 5-7.
http://books.google.com/books?id=0l0OAAAAYAAJ - A. R. Clarke,
Geodesy (Clarendon Press, Oxford, 1880), Chap. 6.
http://books.google.com/books?id=lfIoAAAAYAAJ - W. Jordan,
Handbuch der Vermessungskunde, Vol. 3 (4th Edition, Metzler, Stuggart, 1896), Chaps. 6 & 9.
http://books.google.com/books?id=4KgRAAAAYAAJ
