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.

The theoretical proof was given by Bernhard Riemann around 1900.

Here is the math that you have to use:

Distance = acos(cos(Lat1-Lat2) – (1-cos(Lon1-Lon2)) * cos(Lat1)*cos(Lat2))

Here is some code:

/*

L1 = Original Lat; L2 = Destination Lat;

Lon1 = Original Lon; Lon2 = Destination Lon

D = Distance in Nautical Miles

*/

Lon1 = -Lon1;

Lon2 = -Lon2;

if(( L1 == L2 ) && ( Lon1 == Lon2 )){

return(0);}

temp = ( cos( L1 ) * cos( L2 ) * cos( Lon1 – Lon2 ))+( sin( L1 ) * sin( L2 ));

if( temp == 1 ){

temp = 0;}

elsif ( temp == -1 ){

temp = pi/2;}

else {

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

temp = (( sin( L2 ) – sin( L1 ) * cos( temp )) / (sin( temp ) * cos( L1 )))

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( Lon2 – Lon1 ) > 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 ~