Re: formula for great circle computation

From:         kls@ohare.Chicago.COM (Karl Swartz)
Organization: Chicago Software Works, Menlo Park, California
Date:         04 Oct 95 22:57:26 
References:   1
Followups:    1 2
Next article
View raw article
  or MIME structure

>I wonder if anyone can provide me with the formulae to calculate great
>circle course and distance given the latitude and longitude of the
>departure point and destination.

Distance itself is pretty easy.  Given latitude and longitude in
radians, compute the angle (theta) between the initial and destination
longitudes and normalize it to the range -PI .. PI.  The distance as
an angle is then

    acos( sin(lat1) * sin(lat2)  + cos(lat1) * cos(lat2) * cos(theta) )

Multiply that by the radius of the earth (i.e., 6371.2 kilometers) to
get a reasonable approximation of the great circle distance.

Plotting the course is considerably more work.  You might want to look
at the 'geod' program included with the PROJ.4 mapping program, which
can be picked up via anonymous ftp from

Karl Swartz	|Home
Moderator of sci.aeronautics.airliners -- Unix/network work pays the bills