Skip to main content
Solved

How can I build separate lines from this data?


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.

View original
Did this help you find an answer to your question?

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.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings