Question

Extract polygons from geometrycollection


When overlaying polygons I can get points, lines and polygons in a single result GeometryCollection. I'm sure this is a simple question (and have searched the knowledge base etc), but how do I use FME Workbench to detect such GeometryCollections and then extract just the polygons from the GeometryCollections?


10 replies

Userlevel 4
Badge +30

Hi @simongreener​ 

 

What is transformer Geometrycollection?

 

Thanks in Advance,

Danilo

A GeometryCollection is an OGC data type not an FME transformer. An GeometryCollection can contain heterogeneous geometry types such as Points, linestrings and polygons. Here is an example WKT:

 

GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(0 0,1 1),POLYGON((0 0,10 0,10 10,0 10,0 0)))

 

I want to extract the Polygon from the GeometryCollection

Badge +5

Deaggregate->geometryfilter(area)

Thank you very much.

I looked at GeometryFilter and it doesn't include GeometryCollections in its filter list. I am interested in doing the following so that I don't have to deaggregate multipolygons that don't need deaggrgating.

GeometryFilter(GeometrCollection)->Deaggregate->geometryfilter(area)

Can this be done?

Badge +5

yes its called aggregate in the geometryFilter

Userlevel 4

I think it's not necessary to use the Deaggregator, simply use a GeometryFilter set to Area. It will automatically homogenize any collections/aggregates. In case you have several polygons in the same aggregate, the output aggregate will only contain the polygons.

I think it's not necessary to use the Deaggregator, simply use a GeometryFilter set to Area. It will automatically homogenize any collections/aggregates. In case you have several polygons in the same aggregate, the output aggregate will only contain the polygons.

Thanks, I'll check

Userlevel 1
Badge +21

Thanks, I'll check

The GeometryFilter has a parameter Homogenize Collections - this will need to be set to Yes, then only the area polygons within the collection will pass if geometry type is set to area

image

Userlevel 4

Thanks, I'll check

The parameter "Homogenize collections" is gone in 2022.2, according to the documentation the transformer homogenizes collections when mode is set to Simple (default setting):

"When in simple mode, Aggregate features are automatically homogenized and filtered based on their component type."

https://docs.safe.com/fme/html/FME_Desktop_Documentation/FME_Transformers/Transformers/geometryfilter.htm

Userlevel 1
Badge +21

Thanks, I'll check

Ah, good to know. Homogenize collections is set to No as default in earlier versions so the change to simple being the default is bound to catch me out in future!

Reply