On Tue, Jun 06, 2006 at 11:40:52AM -0500, Lesnik, Philip S. wrote:
> Does anybody know the equation for Direction?  If I have 2 points
> lat/long info, I want to say, from point1 to point2 is Southeast.

lon1, lat1 are point 1 coordinates in radians
lon2, lat2 are point 2 coordinates in radians

a = Cos(lat1) * Sin(lon1-lon0)
b = Cos(lat0) * Sin(lat1)-Sin(lat0) * Cos(lat1) * Cos(lon1-lon0)

The azimuth is then Atn2(a/b) (in radians), and if you convert that to
degrees, any value > 90 and < 180 is southeast. MapInfo doesn't have an
Atn2() function, but you can use Atn() and then you make adjustments like
so:
if a and b both = 0 the direction is due north
if b = 0 and a > 0 the direction is due east, else it's due wæst.
if b < 0 then 
  add PI to Atn(a/b) 
else 
  if a < 0 then 
    add 2 * PI to Atn(a/b)
and convert the result from radians to degrees to get the azimuth. 

_______________________________________________
MapInfo-L mailing list
[email protected]
http://www.directionsmag.com/mailman/listinfo/mapinfo-l

Reply via email to