[postgis-devel] Validity flag

Oliver Courtin olivier.courtin at oslandia.com
Sun Mar 6 13:46:50 PST 2016

Le 5 mars 2016 à 23:14, Daniel Baston a écrit :

Hi Dan,

> Here's an example where GEOS and SFCGAL report a different result for ST_IsValid:
> SELECT ST_IsValid('POLYGON ((0 0 0, 1 0 0, 1 0 0, 1 1 0, 0 1 0, 0 0 1))');
> This returns true with GEOS, but false with SFCGAL (on Hugo's branch, where ST_IsValid is implemented with SFCGAL).  So, we wouldn't want a situation where the flag is set with a GEOS backend and read with a SFCGAL backend.

Yeap that's a really good point !

Indeed as GEOS is 2D only, it won't be able to handle TIN and PS validity check
(not that a big deal as an unknown valid would 'only' impact performances but won't crash PG process), 

but on the other hand as Z dimension is not handled in GEOS a 3D geometry,
as your Polygon Z example, could be declared wrongly valid.
(and this one could lead to crash issue throught SFCGAL/CGAL calls)

Few ideas about it:

- Don't really like the idea to have validity several flags for each backend 
  (idea is to allow new backend to be added later, for example and maybe one day: GGL)

- Quick way to workaround would be to not allow GEOS to set validity flags on 3D geometries (HASZ), or on TIN/PS  



More information about the postgis-devel mailing list