Theres no inbuilt function in MapInfo but this MB function will do the job -
not sure if it behaves itself with Lat/Long but its fine with the national
grids I've worked with. Easily ported to VB, PL-SQL etc.

FUNCTION Brg(BYVAL x1,y1,x2,y2 AS FLOAT) AS FLOAT
'Returns the bearing in radians East zero , anti clockwise)
OnError goto labelError

DIM m AS FLOAT
                IF (x2 = x1) AND (y2 > y1)  THEN
                        m = Pi/2
                ELSE
                        IF (x2 = x1) AND (y2 < y1)  THEN
                                m = -Pi/2
                        ELSE
                                m = ATN((y2-y1)/(x2-x1))
                                'Check for a horizontal line here if you
need to
                                'IF (y2 = y1) AND (x1 > x2) THEN
                                        ' horizontal line
                                '       m = - Pi 
                                'END IF
                        
                                ' Convert to a 4 quadrant ATAN
                                IF x2 < x1 THEN
                                        m = m + Pi
                                END IF
                        END IF
                END IF

                Brg = m
                
Exit FUNCTION
labelError:
        Call ErrorHandler("Brg")
END FUNCTION 'Brg

Paul Crisp
Syntegra

Direct:  0191 461 4522 
Mobile: 0776 414 3762
Fax: (0191) 461 1959

Innovation Place Metro Riverside Park
Delta Bank Road Gateshead Tyne & Wear NE11 9DJ


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: 20 November 2001 14:41
To: [EMAIL PROTECTED]
Subject: MI-L Bearing of a line


Hello all,

Is there any way to find the bearing of a line within MapInfo?

Sincerely,

Brian Van Druten
Forestry Technician
Alligator River NWR




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


********************************************************************

This email may contain information which is privileged or confidential. If you are not 
the intended recipient of this email, please notify the sender immediately and delete 
it without reading, copying, storing, forwarding or disclosing its contents to any 
other person
Thank you

Check us out at http://www.syntegra.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