[Qgis-developer] Geometry validation consistency issues

G. Allegri giohappy at gmail.com
Thu Apr 6 07:21:43 PDT 2017


One of the most discussed topics during my workshops is geometry validation.

As you know not all softwares agree on geometry validity, but we have an
OGC specification that most FOSS softwares adopt which define validity with
good detail. We can agree on it or not, but I think we cannot accept having
different tools behaving differently.

Topology validator and QgsGeometryValidator (which is use by Processing
Check Geometry algorithm) give different results in case of a
"self-intersecting polygon which defines a (false) hole".
I use this definition as a translation of
the GEOSVALID_ALLOW_SELFTOUCHING_RING_FORMING_HOLE GEOS flag which is used
by the QgsGeometryValidator. This flag make GEOS validator stick with
Esri's point of view, so the following polygon is ok for it but not for OGC:

POLYGON ((200 400, 400 400, 400 200, 300 200, 350 250, 250 250, 300 200,
200 200, 200 400))

If you test its validity in Spatialite or PostGIS with ST_IsValid, or if
you test it with the Topology Validation tool, you will obtain that it's
not valid.
If you test it with Check Geometry algorithm it will result as valid.

Here the source lines of the two validations:

Topology validator:
https://github.com/qgis/QGIS/blob/master/src/plugins/topology/topolTest.cpp#L871
QgsGeometryValidator:
https://github.com/qgis/QGIS/blob/master/src/core/qgsgeometryvalidator.cpp#L231

If we want to mantain the opportunity to set that flag, we should manage it
as an option.
>From the user point of view maybe it should be an additional parameter to
set/unset. Something like "OGC strict validity" or maybe something more
meaningful for the layman.

Giovanni
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20170406/6af3fe2f/attachment.html>


More information about the Qgis-developer mailing list