If you're not in a big hurry I can dig out my VFP code for this when I get home on Saturday. I had to do great circle distance and bearing calculations for an RF coordination and engineering package and a whole bunch of RF engineers tested and verified the accuracy..
>Hey all
>
>I've been trying to use the third formula on this page:
>
>
http://en.wikipedia.org/wiki/Great-circle_distance>
>The formula is unnamed, but is indicated as being the most accurate.
>
>My trig is pretty rusty, and I don't think I ever did it on a sphere. :)
>
>I'm plugging in the sample lat-long for BNA and LAX and I'm not getting the same results.
>
>I've converted everything to radians. They name a formula in the "worked example" but that name is not referenced elsewhere on the page, so I'm not even sure which formula they're trying to demonstrate.
>
>Can anyone show me what I'm missing?
>
>Thanks!
>
>
CLEAR
>SET DECIMALS TO 5
>
>m.lat1 = 36.12
>m.long1 = -86.67
>?"lat1",m.lat1,"long1",m.long1
>
>m.lat2 = 33.94
>m.long2 = -118.40
>?"lat2",m.lat2,"long2",m.long2
>
>m.DeltaSigma = MyDistance(m.lat1,m.long1,m.lat2,m.long2)
>
>?"delta-sigma",m.DeltaSigma
>
>m.Dist = m.DeltaSigma * 6372.795
>?m.Dist
>RETURN
>
>
>FUNCTION myDistance
>LPARAMETERS m.lat1, m.long1, m.lat2, m.long2
>LOCAL m.rlat1, m.rlong1, m.rlat2, m.rlong2
>
>m.rlat1 = DTOR(m.lat1)
>m.rlong1 = DTOR(m.long1)
>?"rlat1",m.rlat1,"rlong1",m.rlong1
>
>m.rlat2 = DTOR(m.lat2)
>m.rlong2 = DTOR(m.long2)
>?"rlat2",m.rlat2,"rlong2",m.rlong2
>
>m.DeltaLong = m.long2 - m.long1
>
>m.rDeltaLong = DTOR(m.DeltaLong)
>
>m.DeltaSigma = ;
> atan( ;
> SQRT(;
> (COS(m.rlat2) * SIN(m.rDeltaLong))^2 + ;
> (COS(m.rlat1) * SIN(m.rlat2) - SIN(m.rlat1) * COS(m.rlat2) * COS(m.rDeltaLong))^2;
> ) ;
> / ;
> (SIN(m.rlat1) * SIN(m.rlat2)) + (COS(m.rlat1) * COS(m.rlat2) * COS(m.rDeltaLong)) ;
> )
>
>return m.DeltaSigma
____________________________________
Don't Tread on Me
Overthrow the federal government NOW!
____________________________________