Re: formula for great circle computation

From: (Steve Fenwick)
Organization: Best Internet Communications
Date:         13 Oct 95 01:30:22 
References:   1 2
Next article
View raw article
  or MIME structure

In article <airliners.1995.1582@ohare.Chicago.COM>, kls@ohare.Chicago.COM
(Karl Swartz) wrote:

> >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.

Another formula, slightly more accurate for short distances, but also more
complicated, is:

         (sin( (lat2-lat1)/2) )^2 +
         cos(lat2) * cos(lat1) * (sin( (lon2-lon1)/2) )^2

Course along a great circle varies constantly, of course, except along lines
of longitude, but the departure direction from any point to any other
is also relatively easy:

      cos(lat2) * sin(lon2-lon1) /
         ( cos(lat1) * sin(lat2) ) -
         ( sin(lat1) * cos(lat2) * cos(lon2-lon1) )

Note that you need to use an arctan function equivalent to FORTRAN's ATAN2
for the atan in the second equation, or you need to handle the case of
the numerator and/or denominator going to 0.

One way to plot this is to use the forward and inverse course equations to
plot a series of very short rhumb lines by calculating intermediate
lat/lons based on the starting point of the rhumb line and an arbitrarily
short distance (short relative to map scale.) Iterate until done.

Again, this is all for Earth as a sphere. Caveat lector for flight planning
based on these estimates (flattening is about 1/300.)

(Taken from "Map Projections--A Working Manual", U.S.G.S., p.30.)

Does the FMS in your DiamondJet fly great circles directly, or do
you break it into a series of rhumb lines for it?


Steve Fenwick