Skip to main content

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

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.


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.


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


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.


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


@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.


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?


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


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!​


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