Calculating an angle between two lines in MapInfo

767 views
Skip to first unread message

Pat

unread,
Feb 17, 2015, 7:17:55 AM2/17/15
to mapi...@googlegroups.com
Hi Guys,

I have a question. I have 2 sets of points - Latitude and Longitude. Which I have created the lines by joining two points. Now part of my data have lines which have the same starting or ending point which now makes the lines intersect.

I now want to determine/calculate an angle between the two lines. Is there anyone who can help me with the Mapbasic code.

I have thought about creating a third line that makes it a triangle, then use the cosine area rule too determine the angle that I need, However, I'm still battling in writing the code. Please help.

Regards,
Pat

Lars I. Nielsen (GisPro)

unread,
Feb 17, 2015, 9:42:55 AM2/17/15
to mapi...@googlegroups.com
Hi Pat,

First off, you need to get out of the lat/long scenario. Math on a spheroid is often both horrendeously troublesome and quite unnecessary.

Instead utilize MI Pro's projection capabilities.

In your MB program switch to a stereographic "flat" projection centered tangentially at the point where the two lines originate. This will be your (0,0).

Then fetch the coordinates of the end points of both vectors/lines (which will automatically be converted to the flat projection), and calculate the angle using a simple geometric calculation, e.g. by utilizing formulas on this page: http://en.wikipedia.org/wiki/Dot_product


Best regards / Med venlig hilsen
Lars I. Nielsen
GIS & DB Integrator
GisPro
--
--
You received this message because you are subscribed to the
Google Groups "MapInfo-L" group.To post a message to this group, send
email to mapi...@googlegroups.com
To unsubscribe from this group, go to:
http://groups.google.com/group/mapinfo-l/subscribe?hl=en
For more options, information and links to MapInfo resources (searching
archives, feature requests, to visit our Wiki, visit the Welcome page at
http://groups.google.com/group/mapinfo-l?hl=en

---
You received this message because you are subscribed to the Google Groups "MapInfo-L" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mapinfo-l+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Glen O

unread,
Feb 17, 2015, 9:57:20 AM2/17/15
to mapi...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages