Skip to main content
Solved

Keep association between a generalized line segments and its original segments

  • December 16, 2021
  • 10 replies
  • 23 views

bgeorges
Contributor
Forum|alt.badge.img+5

I have polygons on wich I want to calculate some edges infos. However, I want to do the calculation on generalized edges and after bring it back to all orignal edges.

 

For instance:

Polygon -> edge -> generalized edge -> chopped to 2 vertices lines -> calculate attributes on lines -> merge attributes to original edges

image 

Is there a way at the end I could merge attributes from the generalized line segments to the original line segments?

 

image

Best answer by geomancer

Because your Generalization algorithm does not create new vertices, you can use the starting point of each segment for your association.

Extract the coordinates of the starting points of all segments. Left join on these coordinates.

Merge_AttributesThe original segments that do not share a starting point with the generalized sections will have null vallues in the attributes. In the AttributeManager, these attributes are filled with the attribute value of the previous feature (with Enable Adjacent Feature Attributes).

Merge_Attributes_AttributeManager

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.

10 replies

redgeographics
Celebrity
Forum|alt.badge.img+59
  • Celebrity
  • 3700 replies
  • December 16, 2021

If you add Counter at the start of your process you can give each original feature a unique id (if there's none in the original dataset, otherwise you can use that one) which you can use later on to merge it all back again.


bgeorges
Contributor
Forum|alt.badge.img+5
  • Author
  • Contributor
  • 21 replies
  • December 16, 2021

the counter should be after the chopper, but as you can see there is 2 choppers in the workflow. One for the generalized lines and one for the original.


redgeographics
Celebrity
Forum|alt.badge.img+59
  • Celebrity
  • 3700 replies
  • December 16, 2021

the counter should be after the chopper, but as you can see there is 2 choppers in the workflow. One for the generalized lines and one for the original.

No, before, so that all features going into the chopper have that id and retain it after chopping


bgeorges
Contributor
Forum|alt.badge.img+5
  • Author
  • Contributor
  • 21 replies
  • December 16, 2021

No, before, so that all features going into the chopper have that id and retain it after chopping

No, because all chopped segment will have the same id, and that's not what I want.

 

As you can see in the workflow there is 5 generalized segments which will receive different attributes values and I want to bring those values back to the 8 original segments.


Forum|alt.badge.img+2
  • 1891 replies
  • December 16, 2021

@bgeorges​ You can also preserve and recover original geometries using the GeometryExtractor and GeometryReplacer transformers


bgeorges
Contributor
Forum|alt.badge.img+5
  • Author
  • Contributor
  • 21 replies
  • December 16, 2021

@bgeorges​ You can also preserve and recover original geometries using the GeometryExtractor and GeometryReplacer transformers

I dont think that can achieve what I need. Maybe my question is not clear enough.

Thank you for your suggestion though.


redgeographics
Celebrity
Forum|alt.badge.img+59
  • Celebrity
  • 3700 replies
  • December 17, 2021

No, before, so that all features going into the chopper have that id and retain it after chopping

Yes, so all the chopped segments from line #1 still know they were originally part of line #1, so you can merge attributes back and forth using that id. Isn't that what you want?


geomancer
Evangelist
Forum|alt.badge.img+58
  • Evangelist
  • 932 replies
  • Best Answer
  • December 17, 2021

Because your Generalization algorithm does not create new vertices, you can use the starting point of each segment for your association.

Extract the coordinates of the starting points of all segments. Left join on these coordinates.

Merge_AttributesThe original segments that do not share a starting point with the generalized sections will have null vallues in the attributes. In the AttributeManager, these attributes are filled with the attribute value of the previous feature (with Enable Adjacent Feature Attributes).

Merge_Attributes_AttributeManager


bgeorges
Contributor
Forum|alt.badge.img+5
  • Author
  • Contributor
  • 21 replies
  • December 17, 2021

Because your Generalization algorithm does not create new vertices, you can use the starting point of each segment for your association.

Extract the coordinates of the starting points of all segments. Left join on these coordinates.

Merge_AttributesThe original segments that do not share a starting point with the generalized sections will have null vallues in the attributes. In the AttributeManager, these attributes are filled with the attribute value of the previous feature (with Enable Adjacent Feature Attributes).

Merge_Attributes_AttributeManager

Sounds very promising! Thank you for the suggestion! Great idea!​


geomancer
Evangelist
Forum|alt.badge.img+58
  • Evangelist
  • 932 replies
  • December 20, 2021

You're welcome!

2 things to mind:

  • Null values will be overwritten in the AttributeManager because of the use of adjacent feature attributes. So if you want to keep Null values, use a dummy value, and set in to Null later. The NullAttributeMapper may be of use here.
  • Use 'Group By' (on an attribute that is unique for every feature) when you process more than 1 feature.