Skip to main content
Solved

How can I build separate lines from this data?

  • February 24, 2021
  • 2 replies
  • 28 views

I've been sent some data - a simplified example would be like the below with XY coordinate points each with an attribute to say whether that location was covered or not. I need to create lines from these points, but I only want lines from the points that are 'Yes' covered, and each section of consecutive points that are 'Yes' covered needs to be a different line. Logically if I could ask the questions... "Are you a 'Yes' point?" and "Is the point before/after you a 'No' point?" I could find the first and last points of each line but I don't know how to do this in FME.

ExampleDoes anyone have any solutions or pointers?

Thanks

Best answer by markatsafe

@rwatson​  You need to use the LineBuilder, with a Group By set to the group of each series of points that make up a line. To create that group, you can use the AttributeCreator Advanced Attribute Value Handling. In there you can use Enable Adjacent Feature Attributes. Use a conditional to test if the previous feature was a yes or no. If yes, then add an ID. If No, then increment the ID.

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

2 replies

Forum|alt.badge.img+2
  • Best Answer
  • February 24, 2021

@rwatson​  You need to use the LineBuilder, with a Group By set to the group of each series of points that make up a line. To create that group, you can use the AttributeCreator Advanced Attribute Value Handling. In there you can use Enable Adjacent Feature Attributes. Use a conditional to test if the previous feature was a yes or no. If yes, then add an ID. If No, then increment the ID.


  • Author
  • February 25, 2021

​Thank you - this has got me to where I wanted. I suspect I have gone a bit of a long way around because I couldn't figure out how to increment the ID. Instead I used 2 Attribute Managers one after the other.

 

In the first I created a new attribute and used a conditional statement and the count function to count the first instance of every covered section and add a number to the new attribute.

On the second run I used conditional statements to identify subsequent covered points and rename them to the same number as the first.

 

I can now concatenate these two attributes and create my lines from those.

Thanks again for your help.