Solved

How can I build separate lines from this data?

  • 24 February 2021
  • 2 replies
  • 1 view

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

icon

Best answer by markatsafe 24 February 2021, 20:19

View original

2 replies

Badge +2

@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.

​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