Skip to main content
Solved

Lines from Points file

  • November 20, 2024
  • 3 replies
  • 50 views

deanhowell
Influencer
Forum|alt.badge.img+24

I have a text file that has a list of points

e.g. ID, X, Y

 

I then have another file that has a list of lines

e.g. ID, FromPointID, ToPointID

 

How do I create the lines using the coordinates listed from the points file?

 

 

Best answer by redgeographics

2 FeatureMergers to join the lines with the points twice (merge attributes with a prefix so you can distinguish the from and to x and y), 2 VertexCreators, the first one to create the from point, the second one to add the to point and that should do it.

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.

3 replies

redgeographics
Celebrity
Forum|alt.badge.img+62
  • Celebrity
  • Best Answer
  • November 20, 2024

2 FeatureMergers to join the lines with the points twice (merge attributes with a prefix so you can distinguish the from and to x and y), 2 VertexCreators, the first one to create the from point, the second one to add the to point and that should do it.


geomancer
Evangelist
Forum|alt.badge.img+60
  • Evangelist
  • November 20, 2024

The solution presented by ​@redgeographics works when your lines consist of 2 points.

When your lines are made up of more than 2 points (e.g. line 101 has points 1 through 5) this won't work.

The solution below merges all points data to all lines, and uses ListElementFilter from FME Hub to keep only the listelements where PointID is between FromPointID and ToPointID (both inclusive). These listelements are converted to points, and finally the points are combined to lines by grouping on LineID.

 


deanhowell
Influencer
Forum|alt.badge.img+24
  • Author
  • Influencer
  • November 20, 2024

Thanks ​@redgeographics and ​@geomancer. Fortunately in this situation all lines are 2 points but I do appreciate you taking the time to put together a more extensive response. It is great that there are many options to achieve the same result.