Skip to main content
Solved

Cutting lines into separate segments with their own attribute


Hi, I have a CSV file with 20 spatial points & I was able to convert the points into a line (using LineBuilder) but the line which is created is having a single feature to it. I have used Chopper Transformer to cut the line. It does the job for cutting the lines but all features get same as the first one feature.

How I can separate the feature as well with the lines

Please Help ..!

Best answer by geomancer

geomancer wrote:

Passing your (visible) point data through a modified version of my workspace (see attachment) I get the following results:

Point2Line_v2

Hi @rohan98​ , the VertexCreator changes point features into line features when in Add Point mode.

To make this work, I first added to each feature the coordinates of the next feature as attributes in the AttributeManager, by utilizing the Enable Adjacent Feature Attributes setting, looking forward to the next ('subsequent') feature.

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

11 replies

geomancer
Evangelist
Forum|alt.badge.img+46
  • Evangelist
  • August 9, 2021

You can create lines from the input points, where the second point gets the coordinates of the next feature.

You can realise this by first adding the coordinates of the next feature to a point (using an AttributeManager with 'Enable Adjacent Feature Attributes'), and then adding a vertex to the point, using these coordinates, thus creating a line.

Point2Linein the attached workspace the CSV file contains attributes called X and Y, which FME 'automagically' recognises as coordinates. And of course the last point has to be treated different, as it has no next feature.


drc43
Contributor
Forum|alt.badge.img+11
  • Contributor
  • August 9, 2021

Does your CSV data have a field that indicates which points belong to which lines? (ie. Line1, Line2, etc.) If so, you can Group By this field in the LineBuilder, and it will output separate lines.

 

https://docs.safe.com/fme/html/FME_Desktop_Documentation/FME_Transformers/Transformers/linebuilder.htm?Highlight=linebuilder

 


  • Author
  • August 10, 2021
geomancer wrote:

You can create lines from the input points, where the second point gets the coordinates of the next feature.

You can realise this by first adding the coordinates of the next feature to a point (using an AttributeManager with 'Enable Adjacent Feature Attributes'), and then adding a vertex to the point, using these coordinates, thus creating a line.

Point2Linein the attached workspace the CSV file contains attributes called X and Y, which FME 'automagically' recognises as coordinates. And of course the last point has to be treated different, as it has no next feature.

image3image2image 2 above.

 

I have this data set as shown in image1.

& after transformation I am getting this image2.

image 3 FME work bench.

Can u help me in this.

 

image1

image1 


geomancer
Evangelist
Forum|alt.badge.img+46
  • Evangelist
  • August 10, 2021
geomancer wrote:

You can create lines from the input points, where the second point gets the coordinates of the next feature.

You can realise this by first adding the coordinates of the next feature to a point (using an AttributeManager with 'Enable Adjacent Feature Attributes'), and then adding a vertex to the point, using these coordinates, thus creating a line.

Point2Linein the attached workspace the CSV file contains attributes called X and Y, which FME 'automagically' recognises as coordinates. And of course the last point has to be treated different, as it has no next feature.

Passing your (visible) point data through a modified version of my workspace (see attachment) I get the following results:

Point2Line_v2


  • Author
  • August 11, 2021
geomancer wrote:

Passing your (visible) point data through a modified version of my workspace (see attachment) I get the following results:

Point2Line_v2

Thanks this works 😊 .

I was just trying it in different way like adding a counter to it & giving it a unique id to it & then passing it through the vertex creator (Mode ->Replace with Points) then create a line from with their specified ids but I am ending up 1st attribute to all other.


  • Author
  • August 11, 2021
drc43 wrote:

Does your CSV data have a field that indicates which points belong to which lines? (ie. Line1, Line2, etc.) If so, you can Group By this field in the LineBuilder, and it will output separate lines.

 

https://docs.safe.com/fme/html/FME_Desktop_Documentation/FME_Transformers/Transformers/linebuilder.htm?Highlight=linebuilder

 

I have used counter to generate unique ids to it & then pass it through vertex creator & in line builder when ever I use Group By this field I wont get any output.


geomancer
Evangelist
Forum|alt.badge.img+46
  • Evangelist
  • August 11, 2021
drc43 wrote:

Does your CSV data have a field that indicates which points belong to which lines? (ie. Line1, Line2, etc.) If so, you can Group By this field in the LineBuilder, and it will output separate lines.

 

https://docs.safe.com/fme/html/FME_Desktop_Documentation/FME_Transformers/Transformers/linebuilder.htm?Highlight=linebuilder

 

A solution using 2 LineBuilders in parallel with GroupBy:

Point2Line_v3


  • Author
  • August 11, 2021
geomancer wrote:

A solution using 2 LineBuilders in parallel with GroupBy:

Point2Line_v3

CaptureNow I have above work flow & no I want to connect all the points I have tried with Line Builder I getting single output. Can you please me in this


geomancer
Evangelist
Forum|alt.badge.img+46
  • Evangelist
  • August 11, 2021
geomancer wrote:

A solution using 2 LineBuilders in parallel with GroupBy:

Point2Line_v3

Add the steps from either of my workspaces (VertexCreator in Add Point mode, or LineBuilder, in both cases using appropriate attributes you have created before) and you will get line objects between two adjacent points.

And undoubtedly there are other ways to create the line objects. Try and learn!


  • Author
  • August 12, 2021
geomancer wrote:

Passing your (visible) point data through a modified version of my workspace (see attachment) I get the following results:

Point2Line_v2

Hi @geomancer​ I was having doubt in Point2Line_v2.

how you have created line between two pts without using the any line builder transformer?


geomancer
Evangelist
Forum|alt.badge.img+46
  • Evangelist
  • Best Answer
  • August 13, 2021
geomancer wrote:

Passing your (visible) point data through a modified version of my workspace (see attachment) I get the following results:

Point2Line_v2

Hi @rohan98​ , the VertexCreator changes point features into line features when in Add Point mode.

To make this work, I first added to each feature the coordinates of the next feature as attributes in the AttributeManager, by utilizing the Enable Adjacent Feature Attributes setting, looking forward to the next ('subsequent') feature.


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