Solved

How to create lines from points

  • 17 November 2022
  • 6 replies
  • 7 views

Badge +1

(I have attached the dataset)

I have survey points where each point is less than 2Metres from the next point per run, in a run i can have more than one section, as shown in the attached file, but all the points within this one run are still within a distance of less than 2M from each other. The difference in distance between runs is more than 2M. So it is evident when a new run starts and ends. If i had the attribute run within my dataset i would use the linebuilder and create lines from points.So what i am trying to achieve is to group the data per run. So far i have tried creating a new attribute in the Attribute creator transformer using conditional values but to no success.

 

Anyone with an idea of how i can achieve this?

 

Thanks,

Keller.

icon

Best answer by ebygomm 17 November 2022, 10:45

View original

6 replies

Userlevel 1
Badge +10

There's probably a few different ways you could achieve this

 

Use adjacent attribute handling and conditional tests to assign groups based on the Distance value assuming your points are in order

imageor 

Combine all your points into one line, split into segments with a chopper, discard segments greater than 2m and then combine adjacent lines

Userlevel 4
Badge +30

Hi @keller​ 

Attached Workspace.

 

 

Thanks in Advance,

Danilo

Badge +1

Hi @keller​ 

Attached Workspace.

 

 

Thanks in Advance,

Danilo

Hello @danilo_fme​ , many thanks for your feedback, i have tried to replicate the workflow and I noticed the 1st Linebuilder excludes point number one in the dataset , yet it falls with the 2M threshold,so i did try using @ebygomm​ 's second option where i used a linebuilder without any groupby option , i got one line then did a PointOnLine overlayer to split the line based on points and filtered out the ones with a length of over 2M and combined the lines back to get what i was looking for.

 

Many thanks for the ideas😂 .

Badge +1

There's probably a few different ways you could achieve this

 

Use adjacent attribute handling and conditional tests to assign groups based on the Distance value assuming your points are in order

imageor 

Combine all your points into one line, split into segments with a chopper, discard segments greater than 2m and then combine adjacent lines

Hello @ebygomm​ , thanks for the feedback, i am not able to see the conditional statement in full, would you please maybe share what's in the elseif clause?I could borrow some logic from it.

Thanks,

Keller.

Userlevel 1
Badge +10

Hello @ebygomm​ , thanks for the feedback, i am not able to see the conditional statement in full, would you please maybe share what's in the elseif clause?I could borrow some logic from it.

Thanks,

Keller.

I've updated the screenshot

The conditional statement is first checking if the previous features group attribute has a value, this basically is a check to see if it's the first feature, if it is the value of group gets assigned as zero. Otherwise it looks if the value of distance of the current feature minus the value of the distance of the previous feature is less than 2, if it is it uses the previous value of group, otherwise it increments group by 1.

 

image 

This group attribute can then be used as a group by in the line builder

Badge +1

Hello @ebygomm​ , thanks for the feedback, i am not able to see the conditional statement in full, would you please maybe share what's in the elseif clause?I could borrow some logic from it.

Thanks,

Keller.

Hello @ebygomm​ , many thanks for the feedback, you saved the day, this is exactly what i was looking for, one last thing, i was not able to use your if clause, the Group values of sections (118-150) were always missing or null, so i added a counter before the first attribute creator and used the below clause to achieve,

imagePlease let me know if there is something i missed out. But so far consider my question answered.

Regards,

Keller.

Reply