Skip to main content

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?

 

 

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.


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.

 


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.


Reply