Skip to main content

I have some database tables which contains a few so called "GeometryCollections". I try to use FME to find which objects are of that type so that I can fix them, but none of the alternatives in GeometryFilter will find the GeometryCollection objects. Any suggestions?

Did you try the AggregateFilter?


Yes, but that only tells me which objects that are multi-objects, it doesn't tell me if they contain the same geometry or not. Multi-polygon objects are OK, but not multi-objects with different geometry types.


For instance, we had a database table with 1421 objects, The GeometryFilter showed us that it consisted of 1 Null geometry, 738 (simple) Polygons, 63 Donuts and 619 MultiAreas. The AggregateFilter will find the 619 MultiAreas. But it turned out that one of the 63 Donuts was a donut where the "hole" was a line, so that object was considered to be a GeometryCollection type. But is there a way to find these types with FME?


For instance, we had a database table with 1421 objects, The GeometryFilter showed us that it consisted of 1 Null geometry, 738 (simple) Polygons, 63 Donuts and 619 MultiAreas. The AggregateFilter will find the 619 MultiAreas. But it turned out that one of the 63 Donuts was a donut where the "hole" was a line, so that object was considered to be a GeometryCollection type. But is there a way to find these types with FME?

Have you tried the GeometryValidator set to OGC compliance?


The GeometryFilter in complete mode should allow you to filter out Collections (default setting is Simple). In earlier versions of FME, Homegenize collections needed to be set to No to filter out collections


All available GeometryFilter OutputsWhen I use the GeometryFilter Complete Mode, I get these possible outputs. No "Collections".

Running FME 2022.2


All available GeometryFilter OutputsWhen I use the GeometryFilter Complete Mode, I get these possible outputs. No "Collections".

Running FME 2022.2

Ah, 2021 has a Collection option...

 

Although glad to see the latest has an option for filtering Paths


I thought I had an answer by using the MultipleGeometryFilter transformer, instead of the GeometryFilter, but it works the same way as an AggregateFilter. :-(

 


I thought I had an answer by using the MultipleGeometryFilter transformer, instead of the GeometryFilter, but it works the same way as an AggregateFilter. :-(

 

Are you able to share the problematic geometry? Is it definitely a collection and not a rubbish donut, where the inner polygon is a self intersecting line?

 

Because if it's really a collection of an area and a line, like this

image I would consider it a bug if exiting the donut port

 


Are you able to share the problematic geometry? Is it definitely a collection and not a rubbish donut, where the inner polygon is a self intersecting line?

 

Because if it's really a collection of an area and a line, like this

image I would consider it a bug if exiting the donut port

 

I’ll look into it again on Monday.


Are you able to share the problematic geometry? Is it definitely a collection and not a rubbish donut, where the inner polygon is a self intersecting line?

 

Because if it's really a collection of an area and a line, like this

image I would consider it a bug if exiting the donut port

 

Unfortunately (or not really) I've already corrected the bad geometry (the donut where the "hole" was just a line), so I can't share it - but I still have other database tables with similar problems.

 

Background: We are migrating from an Oracle spatial database to PostGIS, and the PostGIS database is not as lenient towards geometrical errors as Oracle. One of the issues we get is "Table contains GeometryCollections", and as far as I can tell, this warning occurs for instance when we have self-intersecting objects or dangles resulting in multiple geometry types (i.e, a polygon with a dangle, will (as PostGIS sees it) result in a "collection" consisting of a polygon and a line).

 Dangle on PolygonWe should fix dangles, multipoints and self intersections anyway, and as these will show up in a GeometryValidator (OGC compliant) I may not have to find GeometryCollections specifically. When I fix all geometrical errors, these should not occur any more (or so I hope).

Still, it would have been nice to have a way to validate that the data at least does not contain GeometryCollections anymore.


There is a custom transformer GeometryClassExtractor. I think only heterogenous collections are reported as IFMEAggregates with this transformer, so you could use a tester after this to find collections

 

image.pngI suspect however, that what PostGIS is reporting as "Table contains GeometryCollections" are probably not geometries that FME sees as collections, considering your donut example.


Reply