Question

How do I limit the dissolver transformer, or give it a condition?


I have a workbench where I have used Spatial Relator and List Exploder to make a list of polygon IDs and Neighbor_IDs of those polygons touching it. I want to count the number of touching polygons, and if they are greater than 3, find which are the same land cover type.

Something like: for every unique ID with more than three touching polygons of the same land cover type, with a combined area of less than 200,000m^2 -> dissolve.

I have a tester set up to test LC_type ID= LC_type Neighbor_ID, which passes to a counter measuring ID >=3

But I don't know how to give dissolver the condition not to dissolve if the resulting polygon is > 200,000m^2.


2 replies

Userlevel 2
Badge +17

Hi @stochasticsleut, I don't think the Dissolver itself has any option to do that.

Thinking out of the box, you can use the Tester to filter the resulting features after dissolving all the source features, so you can then restore the original features from the features that didn't match the condition if you saved the original geometry as an attribute with the GeometryExtractor before dissolving and also created a list attribute that stores all the attributes (including geometry) from the original features with the Dissolver.

This screenshot illustrates my intention above.

Hope this helps.

Badge +3

You might find it simpler to do in InlineQuerier using SQL.

If feed InlineQuerier the results of the ListExploder then the test becomes:

SELECT UniqueID, Count(*) AS  CountOfGroup, Sum(LCArea) AS DissolveArea, group_concat(NeighborID) AS NeighborIDCommaDelimited
FROM LandCoverPolygons
WHERE LC_type_ID = LC_type_Neighbour_ID
GROUP BY UniqueID
HAVING Count(*)>=5 AND Sum(LCArea)<200000

This will send back the UniqueID subset that can be dissolved with its neighbours and meet the conditions. The NeighbourIDs are in this result as well (This is what the group_concat() aggregate function does) as a Comma delimited text field that can be re-established in a List using AttributeSplitter.

"LCArea" can be determined first with an AreaCalculator.

I've used "Count(*)>=5" because the problem statement was the Number of Neighbours>3, so there needs to be at least 5 polygons in the group to meet this, the subject polygon + 4 or more neighbours......but if you meant something else this can be adjusted.

However, because any of the Neighbours may also independently meet this condition, to derive a final unique Group probably needs to be derived with DuplicateFilter and this be Group By'ed in the Dissolver.

Reply