User:Tim Zukas/Bowring

To find the length and direction of the geodesic (the shortest path) from (lat &phi;1 lon &lambda;1) to (lat &phi;2 lon &lambda;2) on a spheroid with semiaxes a and b (latitude positive northward, longitude positive eastward):

$$ \epsilon \ = \quad \frac{a^2 - b^2}{b^2} \quad = \quad \frac{2r - 1}{(r - 1)^2}$$

where r is the reciprocal of the flattening for the chosen spheroid (e.g. 298.257223563 for WGS84)

$$\Delta\phi = \phi_2 - \phi_1 $$

$$A = \sqrt{1 + \epsilon (cos^4 \phi_1)} \qquad B = \sqrt{1 + \epsilon (cos^2 \phi_1)}$$

$$w = \frac{A}{2}(\lambda_2 - \lambda_1) $$

$$D = \frac{\Delta \phi}{2 B}\Bigg[1 + \frac{3 \epsilon}{4 B^2}(\Delta \phi) \sin (2 \phi_1 + \frac{2}{3} \Delta \phi )\Bigg]$$

$$E = \sin D \cos w$$

$$F = \frac {\sin w}{A} \Big( B \cos \phi_1 \cos D - \sin \phi_1 \sin D \Big)$$

$$\tan G = \frac {F}{E} \qquad \sin \frac{\sigma}{2} = \sqrt{E^2 + F^2}$$

$$\tan H = \frac{\tan w}{A}\Big( \sin \phi_1 + B \cos \phi_1 \tan D \Big)$$

$$distance = \quad \Big( \frac {a^2}{b} \Big) \frac {\sigma}{B^2} \quad = \quad a \Big( \frac{r}{r - 1} \Big) \frac {\sigma}{B^2} $$

$$azimuth \ at \ origin = \quad G - H \qquad azimuth \ at \ far \ end = \quad G + H$$