MapInfo Pro

 View Only
  • 1.  How can I calculate bearing / direction between points?

    Posted 09-20-2018 10:09

    I have a MapInfo table of points and I need to populate a column with bearing / direction from a point (or polygon centroid) in another table.  Is there a MapBasic tool to do this?  I am not a developer, just a user, and have MapInfo Professional v11.5.  Many thanks?



  • 2.  RE: How can I calculate bearing / direction between points?

    Posted 09-21-2018 02:19

    You would need Route data for the respective country and the extension called " Route Finder " to calculate the Turn by turn directions , Shortest / Fastest Route .



  • 3.  RE: How can I calculate bearing / direction between points?

    Employee
    Posted 09-21-2018 07:11

    From the question I don't see that it's necessary to use a routing software to do this. I think @Jane Mason? only want to know the direction (in degrees) from one point towards another point.

    Unfortunately, MapBasic doesn't come with a function like that out-of-the-box so we need to write the function and then use it in a query or update statement.

    Jane, how do you determine what points from table A you want to connect to which point(s) in table B?



  • 4.  RE: How can I calculate bearing / direction between points?

    Posted 09-21-2018 07:21

    Thank you Krishna and Peter - Peter is right in that I only want to know the direction from one point to another point.?  In the case for which I need this, it is all points in table A want to link to just the one point which would exist in table B - although in future there could be more than one point in table B, so table A would have an ID column giving the ID of which point in table B it links to.  I hope this makes sense - may thanks!



  • 5.  RE: How can I calculate bearing / direction between points?

    Employee
    Posted 09-24-2018 06:29

    I found a tool on MapInfo-L, that might help you out.

    The tool UpdateAzimuth can be found in this thread: https://groups.google.com/forum/#!searchin/mapinfo-l/bearing%7Csort:date/mapinfo-l/7vfZWb1ZkNM/Gtq57J6CEwAJ

    It does however require that you have a table with simple lines which then will get a new column added that is updated with the bearing.

    He is a process that can help you create the input table for the tool:

    1. Make a copy of your original table. Preferable it should have a unique ID column if you want to get the bearing back to the original table.

    2. Open the copy, now referred to as _COPY.

    3. Use the MapBasic window to update to create lines for each record towards the single point where 1234.456, 23456.678 should be replaced with the coordinates of the point. Copy and paste these two statements into the MapBasic window, select the statements again and hit the Enter key on the keyboard.

    Set CoordSys Table _COPY

    Update _COPY Set OBJ = CreatLine(CentroidX(OBJ), CentroidY(OBJ), 1234.456, 23456.678)

    4. Save your changes to the _COPY table

    5. Run the UpdateAzimuth tool



  • 6.  RE: How can I calculate bearing / direction between points?

    Posted 09-24-2018 08:50

    Many thanks Peter!  That sounds very helpful - I think I could also create the lines ?using the distance calculator from what I remember, too.  Thanks again!



  • 7.  RE: How can I calculate bearing / direction between points?

    Employee
    Posted 09-24-2018 08:57

    Yes, that's certainly also a workable solution for creating the lines.

    And you could use the SpiderGraph tool if you have an ID linking the two tables.



  • 8.  RE: How can I calculate bearing / direction between points?

    Posted 09-24-2018 10:35

    Great - thanks again Peter.?