Have you ever wondered how you navigate on a round world? Remember Columbus thought was flat. So if the world was flat you could stick two pins in the map, and follow the angle from North. But as we know today the world is round so, sadly that will not work…

So we came up with Great Circle Navigation. Apparently, the first reference to great circle navigation was by John Davis in his book, *The Seaman’s Secrets* (1594). The theory was understood, but in practice it could hardly be applied without accurate computation of longitude.

With Harrison’s Chronometer (1736), this was then possible.

The theoretical proof was given by Bernhard Riemann around 1900.

Here is the math that you have to use:

**Distance = acos(cos(Lat**_{1}-Lat_{2}) – (1-cos(Lon_{1}-Lon_{2})) * cos(Lat_{1})*cos(Lat_{2}))

Here is some code:

/*

L_{1 } = Original Lat; L_{2} = Destination Lat;

Lon_{1} = Original Lon; Lon_{2} = Destination Lon

D = Distance in Nautical Miles

*/

Lon_{1} = -Lon_{1;}

Lon_{2} = -Lon_{2;}

if(( L_{1} == L_{2 }) && ( Lon_{1} == Lon_{2 })){

return(0);}

temp = ( cos( L_{1 }) * cos( L_{2 }) * cos( Lon_{1} – Lon_{2 }))+( sin( L_{1 }) * sin( L_{2 }));

if( temp == 1 ){

temp = 0;}

elsif ( temp == -1 ){

temp = pi/2;}

else {

temp = 0 – atan( temp / sqrt( 1 – ( temp * temp ))) + pi / 2;}

temp = (( sin( L_{2 }) – sin( L_{1 }) * cos( temp )) / (sin( temp ) * cos( L_{1 })))

if( 1 – temp < .00000001 ){

return( 360 );}

elsif ( 1 + temp < .000000001 ){

return( 180 );}

else {

temp = rad2d( -atan( temp / sqrt( 1 – ( temp * temp ))) + pi / 2;)

if( sin( Lon_{2} – Lon_{1 }) > 0 ){

temp = 360 – temp;}

return( temp );}

This code was written in Perl you can run this code on THIS PAGE

sorry for the Perl but it was easyer to test than a page of C hooked to 2 web pages

keep tuned in more to come

Cris ~