Don't assume that sections in polylines are connected or in order or all in the same node sequence order. The following is a representation of valid MapInfo polyline, but it's a topological nightmare:

<--------- 3-section polyline --------->

  sec 2            sec 1         sec 3
o---o-----o   o----o--o-------o o---o--o
3   2     1   1    2  3       4 3   2  1

Notice that node 1, section 1 starts in the middle. Node 4 in section 1 does not connect to node 1, section 2 and in fact, section 1 and 2 are not connected at all. The node sequence direction of section 2 and 3 is opposite of section 1.

The most thorough way to deal with these is first find the endpoints of each section, and figure out which ones are in the same spot (e.g. node 4 section 1 and node 3 section 3 are probably within a reasonable tolerance), and remember what lines they connect to. Then you have to join all the unconnected sections by inserting new sections between sections' nearest endpoints. Then figure out which point you want to start from (and hopefully you didn't try to connect node 3, section 2 with node 1 section 3!) Finally, from the node you've selected as the start point, follow or reorder the nodes in each section so that the sequence matches the direction in which you want to go.

It's a very "interesting" problem unless you are working on a tightly-bid contract in the shadow of a looming deadline. Then it's even more "interesting". There are other pathological variations as well (like a "Y" polyline). These weird beasties are not uncommon in MapInfo tables, either. I once ran into this problem when trying to calculate mileage along bus routes made by creating polylines from MapInfo StreetInfo files. Imagine following the node sequence in the polyline above and tallying the mileage (or kilometerage if you prefer). Do this mechanically and you'll include section 1 three times!

One answer might be to build network topology linkages and operators that allow you to navigate the graphs. You'll need to break up all polylines first into a set of endpoints with one-to-many pointers to lines, and a set of lines with pointers to start and end nodes. Then you'll need functions to navigate from one node to another through a network of polylines. Take a look at the USGS DLG or the TIGER\Line data documentation available online, or search the net for terms like "computational geometry" or "graph theory" or "network topology".

Have fun,
- Bill Thoen

Chris Stephen wrote:

In a multi section polyline, is there a way to determine which section a
node belongs to?
or
Is there a way to construct the direction the complete polyline flows?

eg.
Say I have a polyline with 3 sections.
I can get the number of nodes on the polyline.
I can get the number of sections on the polyline.
I can get the number of nodes in each section.
But, when building an array of node coordinates by looping from section 1 to
section 3, the node coordinates may not be in the correct order because
maybe section 2 starts and is connected to section 3 which runs the other
way and then is connected to section 1.

Any help or other thoughts will be very well received.

TIA,
Chris.

----------------------------------------------------------------------
To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put
"unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]

  

Reply via email to