Skip to main content
Question

How to find the objects which are GeometryCollections


jonas_nelson
Enthusiast
Forum|alt.badge.img+19

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?

12 replies

david_r
Evangelist
  • September 15, 2023

Did you try the AggregateFilter?


jonas_nelson
Enthusiast
Forum|alt.badge.img+19
  • Author
  • Enthusiast
  • September 15, 2023

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.


jonas_nelson
Enthusiast
Forum|alt.badge.img+19
  • Author
  • Enthusiast
  • September 15, 2023

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?


david_r
Evangelist
  • September 15, 2023
jonas_nelson wrote:

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?


ebygomm
Influencer
Forum|alt.badge.img+31
  • Influencer
  • September 15, 2023

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


jonas_nelson
Enthusiast
Forum|alt.badge.img+19
  • Author
  • Enthusiast
  • September 15, 2023

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

Running FME 2022.2


ebygomm
Influencer
Forum|alt.badge.img+31
  • Influencer
  • September 15, 2023
jonas_nelson wrote:

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


jonas_nelson
Enthusiast
Forum|alt.badge.img+19
  • Author
  • Enthusiast
  • September 15, 2023

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

 


ebygomm
Influencer
Forum|alt.badge.img+31
  • Influencer
  • September 15, 2023
jonas_nelson wrote:

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

 


jonas_nelson
Enthusiast
Forum|alt.badge.img+19
  • Author
  • Enthusiast
  • September 15, 2023
ebygomm wrote:

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.


jonas_nelson
Enthusiast
Forum|alt.badge.img+19
  • Author
  • Enthusiast
  • September 18, 2023
ebygomm wrote:

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.


ebygomm
Influencer
Forum|alt.badge.img+31
  • Influencer
  • September 18, 2023

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.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings