Geodesics on an ellipsoid of revolution (original) (raw)

Back to Magnetic models. Forward to Finding nearest neighbors. Up to Contents.

Geodesic and GeodesicLine provide accurate solutions to the direct and inverse geodesic problems. The GeodSolve utility provides an interface to these classes. AzimuthalEquidistant implements the azimuthal equidistant projection in terms of geodesics. CassiniSoldner implements a transverse cylindrical equidistant projection in terms of geodesics. The GeodesicProj utility provides an interface to these projections.

The algorithms used by Geodesic and GeodesicLine are based on a Taylor expansion of the geodesic integrals valid when the flattening f is small. GeodesicExact and GeodesicLineExact evaluate the integrals exactly (in terms of incomplete elliptic integrals). For the WGS84 ellipsoid, the series solutions are about 2–3 times faster and 2–3 times more accurate (because it's easier to control round-off errors with series solutions); thus Geodesic and GeodesicLine are recommended for most geodetic applications. However, in applications where the absolute value of f is greater than about 0.02, the exact classes should be used.

Go to

For some background information on geodesics on triaxial ellipsoids, see Geodesics on a triaxial ellipsoid.

References:

Test data for geodesics

A test set a geodesics is available at

This is about 39 MB (compressed). This consists of a set of geodesics for the WGS84 ellipsoid. A subset of this (consisting of 1/50 of the members — about 690 kB, compressed) is available at

Each line of the test set gives 10 space delimited numbers

These are computed using as direct geodesic calculations with the given lat1, lon1, azi1, and s12. The distance s12 always corresponds to an arc length a12 ≤ 180°, so the given geodesics give the shortest paths from point 1 to point 2. For simplicity and without loss of generality, lat1 is chosen in [0°, 90°], lon1 is taken to be zero, azi1 is chosen in [0°, 180°]. Furthermore, lat1 and azi1 are taken to be multiples of 10−12 deg and s12 is a multiple of 0.1 μm in [0 m, 20003931.4586254 m]. This results in lon2 in [0°, 180°] and azi2 in [0°, 180°].

The direct calculation uses an expansion of the geodesic equations accurate to _f_30 (approximately 1 part in 1050) and is computed with with Maxima's bfloats and fpprec set to 100 (so the errors in the data are probably 1/2 of the values quoted above).

The contents of the file are as follows:

(a total of 500000 entries). The values for s12 for the geodesics running between vertices are truncated to a multiple of 0.1 pm and this is used to determine point 2.

This data can be fed to the GeodSolve utility as follows

Add, e.g., "-p 6", to the call to GeodSolve to change the precision of the output. Adding "-f" causes GeodSolve to print 12 fields specifying the geodesic; these include the 10 fields in the test set plus the geodesic scales M12 and M21 which are inserted between m12 and S12.

Code for computing arbitrarily accurate geodesics in maxima is available in <geodesic.mac> (this depends on <ellint.mac> and uses the series computed by <geod.mac>). This solve both the direct and inverse geodesic problems and offers the ability to solve the problems either using series expansions (similar to Geodesic) or in terms of elliptic integrals (similar to GeodesicExact).

Expansions for geodesics

We give here the series expansions for the various geodesic integrals valid to order _f_10. In this release of the code, we use a 6th-order expansions. This is sufficient to maintain accuracy for doubles for the SRMmax ellipsoid (a = 6400 km, f = 1/150). However, the preprocessor macro GEOGRAPHICLIB_GEODESIC_ORDER can be used to select an order from 3 thru 8. (If using long doubles, with a 64-bit fraction, the default order is 7.) The series expanded to order _f_30 are given in <geodseries30.html>.

In the formulas below ^ indicates exponentiation (_f_^3 = _f_3) and / indicates real division (3/5 = 0.6). The equations need to be converted to Horner form, but are here left in expanded form so that they can be easily truncated to lower order. These expansions were obtained using the Maxima code, <geod.mac>.

In the expansions below, we have

The formula for distance is

\[ \frac sb = I_1(\sigma) \]

where

\[ \begin{align} I_1(\sigma) &= A_1\bigl(\sigma + B_1(\sigma)\bigr) \\ B_1(\sigma) &= \sum_{j=1} C_{1j} \sin 2j\sigma \end{align} \]

and

A1 = (1 + 1/4 * eps^2 + 1/64 * eps^4 + 1/256 * eps^6 + 25/16384 * eps^8 + 49/65536 * eps^10) / (1 - eps);

C1[1] = - 1/2 * eps + 3/16 * eps^3 - 1/32 * eps^5 + 19/2048 * eps^7 - 3/4096 * eps^9; C1[2] = - 1/16 * eps^2 + 1/32 * eps^4 - 9/2048 * eps^6 + 7/4096 * eps^8 + 1/65536 * eps^10; C1[3] = - 1/48 * eps^3 + 3/256 * eps^5 - 3/2048 * eps^7 + 17/24576 * eps^9; C1[4] = - 5/512 * eps^4 + 3/512 * eps^6 - 11/16384 * eps^8 + 3/8192 * eps^10; C1[5] = - 7/1280 * eps^5 + 7/2048 * eps^7 - 3/8192 * eps^9; C1[6] = - 7/2048 * eps^6 + 9/4096 * eps^8 - 117/524288 * eps^10; C1[7] = - 33/14336 * eps^7 + 99/65536 * eps^9; C1[8] = - 429/262144 * eps^8 + 143/131072 * eps^10; C1[9] = - 715/589824 * eps^9; C1[10] = - 2431/2621440 * eps^10;

The function \( \tau(\sigma) = s/(b A_1) = \sigma + B_1(\sigma) \) may be inverted by series reversion giving

\[ \sigma(\tau) = \tau + \sum_{j=1} C'_{1j} \sin 2j\sigma \]

where

C1'[1] = + 1/2 * eps - 9/32 * eps^3 + 205/1536 * eps^5 - 4879/73728 * eps^7 + 9039/327680 * eps^9; C1'[2] = + 5/16 * eps^2 - 37/96 * eps^4 + 1335/4096 * eps^6 - 86171/368640 * eps^8 + 4119073/28311552 * eps^10; C1'[3] = + 29/96 * eps^3 - 75/128 * eps^5 + 2901/4096 * eps^7 - 443327/655360 * eps^9; C1'[4] = + 539/1536 * eps^4 - 2391/2560 * eps^6 + 1082857/737280 * eps^8 - 2722891/1548288 * eps^10; C1'[5] = + 3467/7680 * eps^5 - 28223/18432 * eps^7 + 1361343/458752 * eps^9; C1'[6] = + 38081/61440 * eps^6 - 733437/286720 * eps^8 + 10820079/1835008 * eps^10; C1'[7] = + 459485/516096 * eps^7 - 709743/163840 * eps^9; C1'[8] = + 109167851/82575360 * eps^8 - 550835669/74317824 * eps^10; C1'[9] = + 83141299/41287680 * eps^9; C1'[10] = + 9303339907/2972712960 * eps^10;

The reduced length is given by

\[ \begin{align} \frac mb &= \sqrt{1 + k^2 \sin^2\sigma_2} \cos\sigma_1 \sin\sigma_2 \\ &\quad {}-\sqrt{1 + k^2 \sin^2\sigma_1} \sin\sigma_1 \cos\sigma_2 \\ &\quad {}-\cos\sigma_1 \cos\sigma_2 \bigl(J(\sigma_2) - J(\sigma_1)\bigr) \end{align} \]

where

\[ \begin{align} J(\sigma) &= I_1(\sigma) - I_2(\sigma) \\ I_2(\sigma) &= A_2\bigl(\sigma + B_2(\sigma)\bigr) \\ B_2(\sigma) &= \sum_{j=1} C_{2j} \sin 2j\sigma \end{align} \]

A2 = (1 - 3/4 * eps^2 - 7/64 * eps^4 - 11/256 * eps^6 - 375/16384 * eps^8 - 931/65536 * eps^10) / (1 + eps);

C2[1] = + 1/2 * eps + 1/16 * eps^3 + 1/32 * eps^5 + 41/2048 * eps^7 + 59/4096 * eps^9; C2[2] = + 3/16 * eps^2 + 1/32 * eps^4 + 35/2048 * eps^6 + 47/4096 * eps^8 + 557/65536 * eps^10; C2[3] = + 5/48 * eps^3 + 5/256 * eps^5 + 23/2048 * eps^7 + 191/24576 * eps^9; C2[4] = + 35/512 * eps^4 + 7/512 * eps^6 + 133/16384 * eps^8 + 47/8192 * eps^10; C2[5] = + 63/1280 * eps^5 + 21/2048 * eps^7 + 51/8192 * eps^9; C2[6] = + 77/2048 * eps^6 + 33/4096 * eps^8 + 2607/524288 * eps^10; C2[7] = + 429/14336 * eps^7 + 429/65536 * eps^9; C2[8] = + 6435/262144 * eps^8 + 715/131072 * eps^10; C2[9] = + 12155/589824 * eps^9; C2[10] = + 46189/2621440 * eps^10;

The longitude is given in terms of the spherical longitude by

\[ \lambda = \omega - f \sin\alpha_0 I_3(\sigma) \]

where

\[ \begin{align} I_3(\sigma) &= A_3\bigl(\sigma + B_3(\sigma)\bigr) \\ B_3(\sigma) &= \sum_{j=1} C_{3j} \sin 2j\sigma \end{align} \]

and

A3 = 1 - (1/2 - 1/2n) * eps - (1/4 + 1/8n - 3/8n^2) * eps^2 - (1/16 + 3/16n + 1/16n^2 - 5/16n^3) * eps^3 - (3/64 + 1/32n + 5/32n^2 + 5/128n^3 - 35/128n^4) * eps^4 - (3/128 + 5/128n + 5/256n^2 + 35/256n^3 + 7/256n^4) * eps^5 - (5/256 + 15/1024n + 35/1024n^2 + 7/512n^3) * eps^6 - (25/2048 + 35/2048n + 21/2048n^2) * eps^7 - (175/16384 + 35/4096n) * eps^8 - 245/32768 * eps^9;

C3[1] = + (1/4 - 1/4n) * eps + (1/8 - 1/8n^2) * eps^2 + (3/64 + 3/64n - 1/64n^2 - 5/64n^3) * eps^3 + (5/128 + 1/64n + 1/64n^2 - 1/64n^3 - 7/128n^4) * eps^4 + (3/128 + 11/512n + 3/512n^2 + 1/256n^3 - 7/512n^4) * eps^5 + (21/1024 + 5/512n + 13/1024n^2 + 1/512n^3) * eps^6 + (243/16384 + 189/16384n + 83/16384n^2) * eps^7 + (435/32768 + 109/16384n) * eps^8 + 345/32768 * eps^9; C3[2] = + (1/16 - 3/32n + 1/32n^2) * eps^2 + (3/64 - 1/32n - 3/64n^2 + 1/32n^3) * eps^3 + (3/128 + 1/128n - 9/256n^2 - 3/128n^3 + 7/256n^4) * eps^4 + (5/256 + 1/256n - 1/128n^2 - 7/256n^3 - 3/256n^4) * eps^5 + (27/2048 + 69/8192n - 39/8192n^2 - 47/4096n^3) * eps^6 + (187/16384 + 39/8192n + 31/16384n^2) * eps^7 + (287/32768 + 47/8192n) * eps^8 + 255/32768 * eps^9; C3[3] = + (5/192 - 3/64n + 5/192n^2 - 1/192n^3) * eps^3 + (3/128 - 5/192n - 1/64n^2 + 5/192n^3 - 1/128n^4) * eps^4 + (7/512 - 1/384n - 77/3072n^2 + 5/3072n^3 + 65/3072n^4) * eps^5 + (3/256 - 1/1024n - 71/6144n^2 - 47/3072n^3) * eps^6 + (139/16384 + 143/49152n - 383/49152n^2) * eps^7 + (243/32768 + 95/49152n) * eps^8 + 581/98304 * eps^9; C3[4] = + (7/512 - 7/256n + 5/256n^2 - 7/1024n^3 + 1/1024n^4) * eps^4 + (7/512 - 5/256n - 7/2048n^2 + 9/512n^3 - 21/2048n^4) * eps^5 + (9/1024 - 43/8192n - 129/8192n^2 + 39/4096n^3) * eps^6 + (127/16384 - 23/8192n - 165/16384n^2) * eps^7 + (193/32768 + 3/8192n) * eps^8 + 171/32768 * eps^9; C3[5] = + (21/2560 - 9/512n + 15/1024n^2 - 7/1024n^3 + 9/5120n^4) * eps^5 + (9/1024 - 15/1024n + 3/2048n^2 + 57/5120n^3) * eps^6 + (99/16384 - 91/16384n - 781/81920n^2) * eps^7 + (179/32768 - 55/16384n) * eps^8 + 141/32768 * eps^9; C3[6] = + (11/2048 - 99/8192n + 275/24576n^2 - 77/12288n^3) * eps^6 + (99/16384 - 275/24576n + 55/16384n^2) * eps^7 + (143/32768 - 253/49152n) * eps^8 + 33/8192 * eps^9; C3[7] = + (429/114688 - 143/16384n + 143/16384n^2) * eps^7 + (143/32768 - 143/16384n) * eps^8 + 429/131072 * eps^9; C3[8] = + (715/262144 - 429/65536*n) * eps^8 + 429/131072 * eps^9; C3[9] = + 2431/1179648 * eps^9;

The formula for area between the geodesic and the equator is given in Sec. 6 of Algorithms for geodesics in terms of S,

\[ S = c^2 \alpha + e^2 a^2 \cos\alpha_0 \sin\alpha_0 I_4(\sigma) \]

where

\[ I_4(\sigma) = \sum_{j=0} C_{4j} \cos(2j+1)\sigma \]

In the paper, this was expanded in \( e'^2 \) and \( k^2 \). However, the series converges faster for eccentric ellipsoids if the expansion is in \( n \) and \( \epsilon \). The series to order \( f^{10} \) becomes

C4[0] = + (2/3 - 4/15n + 8/105n^2 + 4/315n^3 + 16/3465n^4 + 20/9009n^5 + 8/6435n^6 + 28/36465n^7 + 32/62985n^8 + 4/11305n^9) - (1/5 - 16/35n + 32/105n^2 - 16/385n^3 - 64/15015n^4 - 16/15015n^5 - 32/85085n^6 - 112/692835n^7 - 128/1616615n^8) * eps - (2/105 + 32/315n - 1088/3465n^2 + 1184/5005n^3 - 128/3465n^4 - 3232/765765n^5 - 1856/1616615n^6 - 6304/14549535n^7) * eps^2 + (11/315 - 368/3465n - 32/6435n^2 + 976/4095n^3 - 154048/765765n^4 + 368/11115n^5 + 5216/1322685n^6) * eps^3 + (4/1155 + 1088/45045n - 128/1287n^2 + 64/3927n^3 + 2877184/14549535n^4 - 370112/2078505n^5) * eps^4 + (97/15015 - 464/45045n + 4192/153153n^2 - 88240/969969n^3 + 31168/1322685n^4) * eps^5 + (10/9009 + 4192/765765n - 188096/14549535n^2 + 23392/855855n^3) * eps^6 + (193/85085 - 6832/2078505n + 106976/14549535n^2) * eps^7 + (632/1322685 + 3456/1616615n) * eps^8 + 107/101745 * eps^9; C4[1] = + (1/45 - 16/315n + 32/945n^2 - 16/3465n^3 - 64/135135n^4 - 16/135135n^5 - 32/765765n^6 - 112/6235515n^7 - 128/14549535n^8) * eps - (2/105 - 64/945n + 128/1485n^2 - 1984/45045n^3 + 256/45045n^4 + 64/109395n^5 + 128/855855n^6 + 2368/43648605n^7) * eps^2 - (1/105 - 16/2079n - 5792/135135n^2 + 3568/45045n^3 - 103744/2297295n^4 + 264464/43648605n^5 + 544/855855n^6) * eps^3 + (4/1155 - 2944/135135n + 256/9009n^2 + 17536/765765n^3 - 3053056/43648605n^4 + 1923968/43648605n^5) * eps^4 + (1/9009 + 16/19305n - 2656/153153n^2 + 65072/2078505n^3 + 526912/43648605n^4) * eps^5 + (10/9009 - 1472/459459n + 106112/43648605n^2 - 204352/14549535n^3) * eps^6 + (349/2297295 + 28144/43648605n - 32288/8729721n^2) * eps^7 + (632/1322685 - 44288/43648605n) * eps^8 + 43/479655 * eps^9; C4[2] = + (4/525 - 32/1575n + 64/3465n^2 - 32/5005n^3 + 128/225225n^4 + 32/765765n^5 + 64/8083075n^6 + 32/14549535n^7) * eps^2 - (8/1575 - 128/5775n + 256/6825n^2 - 6784/225225n^3 + 4608/425425n^4 - 128/124355n^5 - 5888/72747675n^6) * eps^3 - (8/1925 - 1856/225225n - 128/17325n^2 + 42176/1276275n^3 - 2434816/72747675n^4 + 195136/14549535n^5) * eps^4 + (8/10725 - 128/17325n + 64256/3828825n^2 - 128/25935n^3 - 266752/10392525n^4) * eps^5 - (4/25025 + 928/3828825n + 292288/72747675n^2 - 106528/6613425n^3) * eps^6 + (464/1276275 - 17152/10392525n + 83456/72747675n^2) * eps^7 + (1168/72747675 + 128/1865325n) * eps^8 + 208/1119195 * eps^9; C4[3] = + (8/2205 - 256/24255n + 512/45045n^2 - 256/45045n^3 + 1024/765765n^4 - 256/2909907n^5 - 512/101846745n^6) * eps^3 - (16/8085 - 1024/105105n + 2048/105105n^2 - 1024/51051n^3 + 4096/373065n^4 - 1024/357357n^5) * eps^4 - (136/63063 - 256/45045n + 512/1072071n^2 + 494336/33948915n^3 - 44032/1996995n^4) * eps^5 + (64/315315 - 16384/5360355n + 966656/101846745n^2 - 868352/101846745n^3) * eps^6 - (16/97461 + 14848/101846745n + 74752/101846745n^2) * eps^7 + (5024/33948915 - 96256/101846745n) * eps^8 - 1744/101846745 * eps^9; C4[4] = + (64/31185 - 512/81081n + 1024/135135n^2 - 512/109395n^3 + 2048/1247103n^4 - 2560/8729721n^5) * eps^4 - (128/135135 - 2048/405405n + 77824/6891885n^2 - 198656/14549535n^3 + 8192/855855n^4) * eps^5 - (512/405405 - 2048/530145n + 299008/130945815n^2 + 280576/43648605n^3) * eps^6 + (128/2297295 - 2048/1438965n + 241664/43648605n^2) * eps^7 - (17536/130945815 + 1024/43648605n) * eps^8 + 2944/43648605 * eps^9; C4[5] = + (128/99099 - 2048/495495n + 4096/765765n^2 - 6144/1616615n^3 + 8192/4849845n^4) * eps^5 - (256/495495 - 8192/2807805n + 376832/53348295n^2 - 8192/855855n^3) * eps^6 - (6784/8423415 - 432128/160044885n + 397312/160044885n^2) * eps^7 + (512/53348295 - 16384/22863555n) * eps^8 - 16768/160044885 * eps^9; C4[6] = + (512/585585 - 4096/1422135n + 8192/2078505n^2 - 4096/1322685n^3) * eps^6 - (1024/3318315 - 16384/9006855n + 98304/21015995n^2) * eps^7 - (103424/189143955 - 8192/4203199n) * eps^8 - 1024/189143955 * eps^9; C4[7] = + (1024/1640925 - 65536/31177575n + 131072/43648605n^2) * eps^7 - (2048/10392525 - 262144/218243025n) * eps^8 - 84992/218243025 * eps^9; C4[8] = + (16384/35334585 - 131072/82447365*n) * eps^8 - 32768/247342095 * eps^9; C4[9] = + 32768/92147055 * eps^9;

Geodesics in terms of elliptic integrals

GeodesicExact and GeodesicLineExact solve the geodesic problem using elliptic integrals. The formulation of geodesic in terms of incomplete elliptic integrals is given in

The key relations used by GeographicLib are

\[ \begin{align} \frac sb &= E(\sigma, ik), \\ \lambda &= (1 - f) \sin\alpha_0 G(\sigma, \cos^2\alpha_0, ik) \\ &= \chi - \frac{e'^2}{\sqrt{1+e'^2}}\sin\alpha_0 H(\sigma, -e'^2, ik), \\ J(\sigma) &= k^2 D(\sigma, ik), \end{align} \]

where \( \chi \) is a modified spherical longitude given by

\[ \tan\chi = \sqrt{\frac{1+e'^2}{1+k^2\sin^2\sigma}}\tan\omega, \]

and

\[ \begin{align} D(\phi,k) &= \int_0^\phi \frac{\sin^2\theta}{\sqrt{1 - k^2\sin^2\theta}}\,d\theta\\ &=\frac{F(\phi, k) - E(\phi, k)}{k^2},\\ G(\phi,\alpha^2,k) &= \int_0^\phi \frac{\sqrt{1 - k^2\sin^2\theta}}{1 - \alpha^2\sin^2\theta}\,d\theta\\ &=\frac{k^2}{\alpha^2}F(\phi, k) +\biggl(1-\frac{k^2}{\alpha^2}\biggr)\Pi(\phi, \alpha^2, k),\\ H(\phi, \alpha^2, k) &= \int_0^\phi \frac{\cos^2\theta}{(1-\alpha^2\sin^2\theta)\sqrt{1-k^2\sin^2\theta}} \,d\theta \\ &= \frac1{\alpha^2} F(\phi, k) + \biggl(1 - \frac1{\alpha^2}\biggr) \Pi(\phi, \alpha^2, k), \end{align} \]

and \(F(\phi, k)\), \(E(\phi, k)\), \(D(\phi, k)\), and \(\Pi(\phi, \alpha^2, k)\), are incomplete elliptic integrals (see https://dlmf.nist.gov/19.2.ii). The formula for \( s \) and the first expression for \( \lambda \) are given by Legendre (1811) and are the most common representation of geodesics in terms of elliptic integrals. The second (equivalent) expression for \( \lambda \), which was given by Cayley (1870), is useful in that the elliptic integral is relegated to a small correction term. This form allows the longitude to be computed more accurately and is used in GeographicLib. (The equivalence of the two expressions for \( \lambda \) follows from https://dlmf.nist.gov/19.7.E8.)

Nominally, GeodesicExact and GeodesicLineExact will give "exact" results for any value of the flattening. However, the geographic latitude is a distorted measure of distance from the equator with very eccentric ellipsoids and this introducing an irreducible representational error in the algorithms in this case. It is therefore recommended to restrict the use of these classes to b/a ∈ [0.01, 100] or f ∈ [−99, 0.99]. GeodesicExact uses an discrete sine transform fit for the area S12. The number of terms used is adjusted to give accurate results for this same range of flattenings, f ∈ [−99, 0.99].

Thomas (1952) and Rollins (2010) use a different independent variable for geodesics, \(\theta\) instead of \(\sigma\), where \( \tan\theta = \sqrt{1 + k^2} \tan\sigma \). The corresponding expressions for \( s \) and \( \lambda \) are given here for completeness:

\[ \begin{align} \frac sb &= \sqrt{1-k'^2} \Pi(\theta, k'^2, k'), \\ \lambda &= (1-f) \sqrt{1-k'^2} \sin\alpha_0 \Pi(\theta, k'^2/e^2, k'), \end{align} \]

where \( k' = k/\sqrt{1 + k^2} \). The expression for \( s \) can be written in terms of elliptic integrals of the second kind and Cayley's technique can be used to subtract out the leading order behavior of \( \lambda \) to give

\[ \begin{align} \frac sb &=\frac1{\sqrt{1-k'^2}} \biggl( E(\theta, k') - \frac{k'^2 \sin\theta \cos\theta}{\sqrt{1-k'^2\sin^2\theta}} \biggr), \\ \lambda &= \psi + (1-f) \sqrt{1-k'^2} \sin\alpha_0 \bigl( F(\theta, k') - \Pi(\theta, e^2, k') \bigr), \end{align} \]

where

\[ \begin{align} \tan\psi &= \sqrt{\frac{1+k^2\sin^2\sigma}{1+e'^2}}\tan\omega \\ &= \sqrt{\frac{1-e^2}{1+k^2\cos^2\theta}}\sin\alpha_0\tan\theta. \end{align} \]

The tangents of the three "longitude-like" angles are in geometric progression, \( \tan\chi/\tan\omega = \tan\omega/\tan\psi \).

Parameters for the meridian

The formulas for \( s \) given in the previous section are the same as those for the distance along a meridian for an ellipsoid with equatorial radius \( a \sqrt{1 - e^2 \sin^2\alpha_0} \) and polar semi-axis \( b \). Here is a list of possible ways of expressing the meridian distance in terms of elliptic integrals using the notation:

The eccentricities \( (e, e') \) are real (resp. imaginary) for oblate (resp. prolate) ellipsoids. The elliptic variables \((u, u')\) and \((v, v')\) are defined by

and are linearly related by

The cartesian coordinates for the meridian \( (x, z) \) are given by

\[ \begin{align} x &= a \cos\beta = a \cos\phi / \sqrt{1 - e^2 \sin^2\phi} \\ &= a \sin\beta' = (a^2/b) \sin\phi' / \sqrt{1 + e'^2 \sin^2\phi'} \\ &= a \,\mathrm{cn}(v, ie) = a \,\mathrm{cd}(u, e) \\ &= a \,\mathrm{sn}(u', e) = (a^2/b) \,\mathrm{sd}(v', ie'), \end{align} \]

\[ \begin{align} z &= b \sin\beta = (b^2/a) \sin\phi / \sqrt{1 - e^2 \sin^2\phi} \\ &= b \cos\beta' = b \cos\phi' / \sqrt{1 + e'^2 \sin^2\phi'} \\ &= b \,\mathrm{sn}(v, ie) = (b^2/a) \,\mathrm{sd}(u, e) \\ &= b \,\mathrm{cn}(u', e) = b \,\mathrm{cd}(v', ie'). \end{align} \]

The distance along the meridian can be expressed variously as

\[ \begin{align} y &= b \int \sqrt{1 + e'^2 \sin^2\beta}\, d\beta = b E(\beta, ie') \\ &= \frac{b^2}a \int \frac1{(1 - e^2 \sin^2\phi)^{3/2}}\, d\phi = \frac{b^2}a \Pi(\phi, e^2, e) \\ &= a \biggl(E(\phi, e) - \frac{e^2\sin\phi \cos\phi}{\sqrt{1 - e^2\sin^2\phi}}\biggr) \\ &= b \int \mathrm{dn}^2(v, ie')\, dv = \frac{b^2}a \int \mathrm{nd}^2(u, e)\, du = \cal E(v, ie'), \end{align} \]

\[ \begin{align} y' &= a \int \sqrt{1 - e^2 \sin^2\beta'}\, d\beta' = a E(\beta', e) \\ &= \frac{a^2}b \int \frac1{(1 + e'^2 \sin^2\phi')^{3/2}}\, d\phi' = \frac{a^2}b \Pi(\phi', -e'^2, ie') \\ &= b \biggl(E(\phi', ie') + \frac{e'^2\sin\phi' \cos\phi'}{\sqrt{1 + e'^2\sin^2\phi'}}\biggr) \\ &= a \int \mathrm{dn}^2(u', e)\, du' = \frac{a^2}b \int \mathrm{nd}^2(v', ie')\, dv' = \cal E(u', e), \end{align} \]

with the quarter meridian distance given by

\[ M = aE(e) = bE(ie') = (b^2/a)\Pi(e^2,e) = (a^2/b)\Pi(-e'^2,ie'). \]

(Here \( E, F, \Pi \) are elliptic integrals defined in https://dlmf.nist.gov/19.2.ii. \( \cal E, \mathrm{am}, \mathrm{sn}, \mathrm{cn}, \mathrm{sd}, \mathrm{cd}, \mathrm{dn}, \mathrm{nd} \) are Jacobi elliptic functions defined in https://dlmf.nist.gov/22.2 and https://dlmf.nist.gov/22.16.)

There are several considerations in the choice of independent variable for evaluate the meridian distance

GeographicLib uses the geodesic generalization of \( y = b E(\beta, ie') \), namely \( s = b E(\sigma, ik) \). See Geodesics in terms of elliptic integrals.

Comparison of meridian measures

Short geodesics

Here we describe Bowring's method for solving the inverse geodesic problem in the limit of short geodesics and contrast it with the great circle solution using Bessel's auxiliary sphere. References:

Bowring considers the conformal mapping of the ellipsoid to a sphere of radius \( R \) such that circles of latitude and meridians are preserved (and hence the azimuth of a line is preserved). Let \( (\phi, \lambda) \) and \( (\phi', \lambda') \) be the latitude and longitude on the ellipsoid and sphere respectively. Define isometric latitudes for the sphere and the ellipsoid as

\[ \begin{align} \psi' &= \sinh^{-1} \tan \phi', \\ \psi &= \sinh^{-1} \tan \phi - e \tanh^{-1}(e \sin\phi). \end{align} \]

The most general conformal mapping satisfying Bowring's conditions is

\[ \psi' = A \psi + K, \quad \lambda' = A \lambda, \]

where \( A \) and \( K \) are constants. (In fact a constant can be added to the equation for \( \lambda' \), but this does affect the analysis.) The scale of this mapping is

\[ m(\phi) = \frac{AR}{\nu}\frac{\cos\phi'}{\cos\phi}, \]

where \( \nu = a/\sqrt{1 - e^2\sin^2\phi} \) is the transverse radius of curvature. (Note that in Bowring's Eq. (10), \( \phi \) should be replaced by \( \phi' \).) The mapping from the ellipsoid to the sphere depends on three parameters \( R, A, K \). These will be selected to satisfy certain conditions at some representative latitude \( \phi_0 \). Two possible choices are given below.

Bowring's method

Bowring (1981) requires that

\[ m(\phi_0) = 1,\quad \left.\frac{dm(\phi)}{d\phi}\right|_{\phi=\phi_0} = 0,\quad \left.\frac{d^2m(\phi)}{d\phi^2}\right|_{\phi=\phi_0} = 0, \]

i.e, \(m\approx 1\) in the vicinity of \(\phi = \phi_0\). This gives

\[ \begin{align} R &= \frac{\sqrt{1 + e'^2}}{B^2} a, \\ A &= \sqrt{1 + e'^2 \cos^4\phi_0}, \\ \tan\phi'_0 &= \frac1B \tan\phi_0, \end{align} \]

where \( e' = e/\sqrt{1-e^2} \) is the second eccentricity, \( B = \sqrt{1+e'^2\cos^2\phi_0} \), and \( K \) is defined implicitly by the equation for \(\phi'_0\). The radius \( R \) is the (Gaussian) mean radius of curvature of the ellipsoid at \(\phi_0\) (so near \(\phi_0\) the ellipsoid can be deformed to fit the sphere snugly). The third derivative of \( m \) is given by

\[ \left.\frac{d^3m(\phi)}{d\phi^3}\right|_{\phi=\phi_0} = \frac{-2e'^2\sin2\phi_0}{B^4}. \]

The method for solving the inverse problem between two nearby points \( (\phi_1, \lambda_1) \) and \( (\phi_2, \lambda_2) \) is as follows: Set \(\phi_0 = (\phi_1 + \phi_2)/2\). Compute \( R, A, \phi'_0 \), and hence find \( (\phi'_1, \lambda'_1) \) and \( (\phi'_2, \lambda'_2) \). Finally, solve for the great circle on a sphere of radius \( R \); the resulting distance and azimuths are good approximations for the corresponding quantities for the ellipsoidal geodesic.

Consistent with the accuracy of this method, we can compute \(\phi'_1\) and \(\phi'_2\) using a Taylor expansion about \(\phi_0\). This also avoids numerical errors that arise from subtracting nearly equal quantities when using the equation for \(\phi'\) directly. Write \(\Delta \phi = \phi - \phi_0\) and \(\Delta \phi' = \phi' - \phi'_0\); then we have

\[ \Delta\phi' \approx \frac{\Delta\phi}B \biggl[1 + \frac{\Delta\phi}{B^2}\frac{e'^2}2 \biggl(3\sin\phi_0\cos\phi_0 + \frac{\Delta\phi}{B^2} \bigl(B^2 - \sin^2\phi_0(2 - 3 e'^2 \cos^2\phi_0)\bigr)\biggr)\biggr], \]

where the error is \(O(f\Delta\phi^4)\). This is essentially Bowring's method. Significant differences between this result, "Bowring (improved)", compared to Bowring's paper, "Bowring (original)", are:

In fact, arguably, the highest order \(O(f\Delta\phi^3)\) terms should be dropped altogether. Their inclusion does result in a better estimate for the distance. However, if your goal is to generate both accurate distances and accurate azimuths, then \(\Delta\phi\) needs to be restricted sufficiently to allow these terms to be dropped to give the "Bowring (truncated)" method.

With highly eccentric ellipsoids, the parametric latitude \( \beta \) is a better behaved independent variable to use. In this case, \( \phi_0 \) is naturally defined using \(\beta_0 = (\beta_1 + \beta_2)/2\) and in terms of \(\Delta\beta = \beta - \beta_0\), we have

\[ \Delta\phi' \approx \frac{\Delta\beta}{B'} \biggl[1 + \frac{\Delta\beta}{B'^2}\frac{e'^2}2 \biggl(\sin\beta_0\cos\beta_0 + \frac{\Delta\beta}{3B'^2} \bigl( \cos^2\beta_0 - \sin^2\beta_0 B'^2\bigr) \biggr)\biggr], \]

where \(B' = \sqrt{1+e'^2\sin^2\beta_0} = \sqrt{1+e'^2}/B\), and the error once again is \(O(f\Delta\phi^4)\). This is the "Bowring (using \(\beta\))" method.

Bessel's auxiliary sphere

GeographicLib's uses the auxiliary sphere method of Legendre, Bessel, and Helmert. For short geodesics, this is equivalent to picking \( R, A, K \) so that

\[ m(\phi_0) = 1,\quad \left.\frac{dm(\phi)}{d\phi}\right|_{\phi=\phi_0} = 0,\quad \tan\phi'_0 = (1 - f) \tan\phi_0. \]

Bowring's requirement that the second derivative of \(m\) vanish has been replaced by the last relation which states that \(\phi'_0 = \beta_0\), the parametric latitude corresponding to \(\phi_0\). This gives

\[ \begin{align} R &= B'(1-f)a, \\ A &= \frac1{B'(1-f)}, \\ \left.\frac{d^2m(\phi)}{d\phi^2}\right|_{\phi=\phi_0} &= -e^2B'^2\sin^2\phi_0. \end{align} \]

Similar to Bowring's method, we can compute \(\phi'_1\) and \(\phi'_2\) using a Taylor expansion about \(\beta_0\). This results in the simple expression

\[ \Delta\phi' \approx \Delta\beta, \]

where the error is \(O(f\Delta\beta^2)\).

Estimating the accuracy

In assessing the accuracy of these methods we use two metrics:

(The second metric is much more stringent.) We may now compare the methods by asking for a bound to the length of a geodesic which ensures that the one or other of the errors fall below 1 mm (an "engineering" definition of accurate) or 1 nm (1 nanometer, about the round-off limit).

Maximum distance that can be used in various methods for computing short geodesics while keeping the errors within prescribed bounds

method distance metric azimuth metric
1 mm error 1 nm error 1 mm error 1 nm error
Bowring (original) 87 km 870 m 35 km 350 m
Bowring (improved) 180 km 1.8 km 58 km 580 m
Bowring (truncated) 52 km 520 m 52 km 520 m
Bowring (using \(\beta\)) 380 km 24 km 60 km 600 m
Bessel's aux. sphere 42 km 420 m 1.7 km 1.7 m

For example, if you're only interested in measuring distances and an accuracy of 1 mm is sufficient, then Bowring's improved method can be used for distances up to 180 km. On the other hand, GeographicLib uses Bessel's auxiliary sphere and we require both the distance and the azimuth to be accurate, so the great circle approximation can only be used for distances less than 1.7 m. The reason that GeographicLib does not use Bowring's method is that the information necessary for auxiliary sphere method is already available as part of the general solution and, as much as possible, we allow all geodesics to be computed by the general method.

Back to Magnetic models. Forward to Finding nearest neighbors. Up to Contents.