I was wondering if there is a way to update a column in MapInfo with the digitised line direction. I have two TAB files, one is complete lines and the other is sections of the same lines (both have a unique ID). I was wondering if it would be possible to add a column in both files with the direction of the line so I can check if the directions are identical, e.g:
Thanks,
Alan
Best Answer
I would run they each of the individual segments and for each find the matching node in the complex polyline for the start as well as the end node of the section.
Now you can check if the end node number is larger than the start node number. If so the line direction of the section is the same as the direction of the polyline.
If not, the direction is reverted.
Here's some code that can help you find the node number within a polyline/polygon with only one segment:
The fundemental structure of the Binary search function has been made by Bill Thoen who shared it on MapInfo-L more than a year ago.
This is how to use the code above:
Notice that in the sample above I'm expected you to only have one polyline. If that's not the case you need to figure out how to link the current line to the matching polyline. If the line table holds a reference ID for the polyline table, you can use this.