Solved

Sequence of points along line

  • 6 September 2017
  • 16 replies
  • 42 views

Hello all,

I have a question for which I feel like the answer should be simple. But for some reason I cannot find anything in Knowledge Center or think of a way to do it.

I have a network of lines with points all along them. The points are not necessarily at the start or end of a line but along them.

I need to sequence the points starting from the start of a line segment to the end (it doesn't matter which direction). The first point along the start of a line should be flagged as point 1, the next as point 2 and so on. If a line branches off, the first point on that line will be point 1 again and so on.

In the above example, we can also start from point 4 and go downwards in a sequence.

Any help will be much appreciated. Thanks

Edit: I am using 2016.0 fme desktop

icon

Best answer by jdh 6 September 2017, 21:11

View original

16 replies

Userlevel 2
Badge +12

I have created a sample workspace that allows this for one line.

You might have to adjust this and group by Line identifier.

line-point-sequence.fmw

I have created a sample workspace that allows this for one line.

You might have to adjust this and group by Line identifier.

line-point-sequence.fmw

Hello @erik_jan

 

Thanks for your time. Can you please send me a screenshot with annotation of the workspace? I forgot to mention that I am using 2016.0. Several of the transformers are not showing up at my end

 

Badge +22

I would do it using measures.

 

MeasureGenerator on the Line, PointOnLineOverlayer, ExtractMeasures on the points, sort by measures, Counter (by LineID)

 

 

pointsequence.fmw
Userlevel 2
Badge +12
Hello @erik_jan

 

Thanks for your time. Can you please send me a screenshot with annotation of the workspace? I forgot to mention that I am using 2016.0. Several of the transformers are not showing up at my end

 

See this image:

 

 

Userlevel 2
Badge +17

I would do it using measures.

 

MeasureGenerator on the Line, PointOnLineOverlayer, ExtractMeasures on the points, sort by measures, Counter (by LineID)

 

 

pointsequence.fmw
I agree that measure manipulation is the way to go.

 

If you need to consider the network flow orientation, the NetworkCostCalculator could be used to add measure to the lines according to the flow orientation from a specific source node.

 

See the attached workspace example: point-sequence-2016.fmw (FME 2016.0.1.2)

 

 

I have created a sample workspace that allows this for one line.

You might have to adjust this and group by Line identifier.

line-point-sequence.fmw

Hello @erik_jan, thanks for sending me the image. Sorry for getting back to you later as I was pulled away from this project for a bit. I am coming back to it now. I love the method you described. It works really well for single lines. The problem is for the situation I have where there are many different branches. I tried playing around with your script and grouping by Line_ID for the PointToLine and PointToPoint Overlayer transformers. My Counter is the problem. I cannot select "group by" for the Counter. So having branches just throws the Counter off. Can you think of a solution for that? Appreciate your time. Thanks

I would do it using measures.

 

MeasureGenerator on the Line, PointOnLineOverlayer, ExtractMeasures on the points, sort by measures, Counter (by LineID)

 

 

pointsequence.fmw
Hello @jdh, thanks for your response. I cannot see your solution since I have an older version of FME

 

Badge +22
Hello @jdh, thanks for your response. I cannot see your solution since I have an older version of FME

 

10761-pointsequence.fmw - 2016

 

 

Badge +22
Hello @erik_jan, thanks for sending me the image. Sorry for getting back to you later as I was pulled away from this project for a bit. I am coming back to it now. I love the method you described. It works really well for single lines. The problem is for the situation I have where there are many different branches. I tried playing around with your script and grouping by Line_ID for the PointToLine and PointToPoint Overlayer transformers. My Counter is the problem. I cannot select "group by" for the Counter. So having branches just throws the Counter off. Can you think of a solution for that? Appreciate your time. Thanks
You set a "group-by" on the counter by setting the counter name to an attribute (which contains the group)
You set a "group-by" on the counter by setting the counter name to an attribute (which contains the group)

@jdh, I don't have that option of setting an attribute to the Counter. These are the options I have.

 

 

10761-pointsequence.fmw - 2016

 

 

Thanks. I am testing out your and Takashis response to see if that method works for my project!

 

 

Badge +22

@jdh, I don't have that option of setting an attribute to the Counter. These are the options I have.

 

 

Counter Name, not counter scope

 

 

I agree that measure manipulation is the way to go.

 

If you need to consider the network flow orientation, the NetworkCostCalculator could be used to add measure to the lines according to the flow orientation from a specific source node.

 

See the attached workspace example: point-sequence-2016.fmw (FME 2016.0.1.2)

 

 

Hi Takashi, so far your method has worked the best for me. Thank you.

 

I am working with a network set. I am going a bit off the question here. If I had a group of lines with different sources, how would I go about using this method there? I used the following:

 

1) Used a SpatialRelator to transfer the line_Id to the source nodes.

 

2) Used Group By: Line_ID for all the following: TopologyBuilder, NetworkCostCalculator, PointonLineOverlayer

 

3) There doesn't seem to be any way to use Group By in MeasureExtractor. Furthermore, as soon as all my points go through the transformer, they are rejected.

 

I am unsure what is going on.

 

Thanks
Userlevel 2
Badge +17
I agree that measure manipulation is the way to go.

 

If you need to consider the network flow orientation, the NetworkCostCalculator could be used to add measure to the lines according to the flow orientation from a specific source node.

 

See the attached workspace example: point-sequence-2016.fmw (FME 2016.0.1.2)

 

 

A possible reason is that the points don't have Line_ID. If the points don't have Line_ID, the PointOnLineOverlayer (Group By: Line_ID) can not group points and lines belonging to the same network, then does nothing.

 

I don't think that you need to set Group By to the PointOnLineOverlayer in this case, since the transformer recognizes points spatially related to a line and transfers Line_ID from the line to the related points.

 

@jdh, I don't have that option of setting an attribute to the Counter. These are the options I have.

 

 

@jdh

 

Oh my! I didn't realize that. Thanks!
A possible reason is that the points don't have Line_ID. If the points don't have Line_ID, the PointOnLineOverlayer (Group By: Line_ID) can not group points and lines belonging to the same network, then does nothing.

 

I don't think that you need to set Group By to the PointOnLineOverlayer in this case, since the transformer recognizes points spatially related to a line and transfers Line_ID from the line to the related points.

 

You are correct about the point not having IDs. I was able to resolve the issue using your method. Thank you so much!

 

 

Reply