Hi Brian,
Once connect all the lines that are touching each other at the end nodes with the LineJoiner (Preserve Original Orientation: no,
Preserve Lines as Path Segments: Yes), and then split resulting paths with the PathSplitter.
The PathSplitter will add the Segment Number Attribute (called "_segment_number" by default) which will contain your required sort order.
And, if you want to preserve attributes of the original line,
- specify a list attribute name to the "List Name" parameter of the LineJoiner,
- set the "List Attribute" parameter of the PathSplitter to the list name.
In the procedure, FME will adjust automatically orientation of lines belonging to a same path into the same direction.
If you need to restore the original orientation, see the hidden attribute named "direction" that will be given by the PathSplitter. It contains "same" or "opposite", you can check if the direction of the resulting line is same as the original line, and restore the orientation of the "opposite" lines with the Orientor (Orientation Type: REVERSE).
Takashi
correction.
The "direction" attribute will be given by the LineJoiner when you specified the "List Name".
This is one (of many i assume) to do it.
Overlay is in this because i had more than 1 object in my file. If you work on 1 object only you can skip overlay and tester_2.
The original points were not ordered, after this they are.
Thank you both for your excellent responses. I hope to test them later today.
An additional requirement pertains to the starting point. I know the start point vertex to start counting from (the Point of Commencement is an x,y coordinate in a separate feature class) so I need to inject that workflow now as well.
Thanks again for sharing your knowledge. It's invaluable for us newbies.
cheers...B
Divide the original lines into the first one and others.
To the first line, give the first sort order attribute (e.g. 0).
Give 0-based segment number to other lines with the procedure I mentioned first, and then, add 1 to their segment number with the ExpressionEvaluator.