Skip to main content
Solved

Keep association between a generalized line segments and its original segments


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

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

10 replies

redgeographics
Celebrity
Forum|alt.badge.img+48

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
  • 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+48
bgeorges wrote:

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
  • December 16, 2021
redgeographics wrote:

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
  • 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
  • December 16, 2021
markatsafe wrote:

@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+48
redgeographics wrote:

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+47
  • Evangelist
  • 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
  • December 17, 2021
geomancer wrote:

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+47
  • Evangelist
  • 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.

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