Dissolving then Aggregating, concatenating attributes
Just want to check I’m not missing something obvious.
I want to dissolve some polygons and then aggregate distinct areas into multipolygons. One of the attributes of the original polygons needs to be concatenated into a single line with no duplicates. Fairly simple with a list builder/listduplicateremover/listconcatenator if i was only using the dissolver. But if i want to get combine attributes from both processes it seems unnecessarily complicated without resorting to python (which only requires a couple of lines).
Am I missing an easier way to do this?
Start
End
Page 1 / 1
Hi @ebygomm ,
I don't know if you'd call it simple, a possible way I can think of is,
Separate the data flow into two streams.
On the first stream, process the polygons with Dissolver and Aggregator, without concatenating the attribute.
On the second stream, remove dupliates on the attribute with DuplicateFilter and concatnate them with Aggregator.
Finally, merge the concatenated attribute to the feature processed in the first stream.
Certainly, simpler than anything I’d have thought of, I have 5 separate streams I’m already dissolving and aggregating so I think I’m going to stick with my python solution for this which is building two lists and then combining, deduplicating and concatenating. But I knew there should be a more straightforward FME way but I was getting hung up on lists
import fme import fmeobjects
def processFeature(feature): v = list(set(feature.getAttribute('dissolve{}.Value')+feature.getAttribute('aggregate{}.Value'))) feature.setAttribute("Value",' / '.join(v))
I'm afraid that your solution could cause unexpected result, if the data flow consists of Dissolver, Aggregator, and PythonCaller connected in series.
For example, in the case of this screenshot,
after dissolving, resulting features will have these attributes.
feature 1
Value = 'a'
dissolve{0}.Value = 'a'
dissolve{1}.Value = 'b'
feature 2
Value = 'c'
dissolve{0}.Value = 'c'
dissolve{1}.Value = 'd'
feature 3
Value = 'a'
dissolve{0}.Value = 'a'
Then, if you perform aggregating them with Aggregator, resulting feature will have these attributes.
feature
Value = 'a'
dissolve{0}.Value = 'a'
dissolve{1}.Value = 'b'
aggregate{0}.Value = 'a'
aggregate{1}.Value = 'c'
aggregate{2}.Value = 'a'
The value 'd' is missing.
That scenario doesn’t actually occur in my data but a good warning. I’ve tweaked my workflow