Luis Baptista wrote:
> 
> Hi,
> 
> there are any query or Function to update a column with an azimuth, in
> degrees, of a line?
> The same way I use "ObjectLen" I want to know the azimuth, considering North
> as 0 (zero) degrees, East 90�, South 180� and West 270�.
> 
> If I don't have a function or something like that to do this, how can I find
> a tool or how can I create it?

There is no "Info" function in MapInfo to return a line's azimuth,
but there are a couple of ways to calculate it. If your line is
short enough, the Pythagorean theorem will give you a useable
result. If your line is long, or you need the accuracy, then use the
formulae used in great circle navigation (see Ed Williams' Aviation
formulary page at http://www.best.com/~williams/avform.htm.)

To use the Pythagorean method, you should first set your coordinate
system to projected units so that distances in y are the same as in
x for equal units. THen to calculate the angle made between the
starting and ending points, use:

Ang = Atn (dy/dx) * 57.29577951

Where Ang is the trigonometric angle, dx is the difference between
your ending point X and starting point X coordinate; dy is similar.
The number 57.29577951 is simply 180/PI which converts radians to
degrees. This returns an angle between -90 and 90 degrees.

To find the azimuth, you next have to determine the quadrant and
apply the proper adjustment. If both dx and dy are positive, you are
in the first quadrant, so subtract the angle from 90. If dx is
negative and dy is positive, you are in quadrant 2, so add 360 to
the angle. Finally, if dy is negative, you are either in quadrant 3
or 4, but it doesn't matter; just add 180 to the angle to get the
azimuth.

There's probably a more elegant solution, but that will work. If
you're working in MapInfo only, then you might have to do column
updates in several steps, or you can code up these steps in the
MapBasic window and save the script to use it again. 

-- 
- Bill Thoen
------------------------------------------------------------ 
GISnet, 1401 Walnut St., Suite C, Boulder, CO  80302
tel: 303-786-9961, fax: 303-443-4856
mailto:[EMAIL PROTECTED], http://www.gisnet.com
------------------------------------------------------------



_______________________________________________________________________
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, send e-mail to [EMAIL PROTECTED] and
put "unsubscribe MapInfo-L" in the message body.

Reply via email to