[Qgis-developer] QGIS 1.8 - check geometry validity not working

a.furieri at lqt.it a.furieri at lqt.it
Tue May 8 03:17:47 PDT 2012

On Mon, 7 May 2012 18:57:17 +0200, Sandro Santilli wrote:
> How did you import the geometries ?

Serendipity, i.e. finding something useful by pure hazard :-)

Short report explaining this puzzling mystery:
- the disputed Geometry has *two* distinct rings
- the main one is correctly marked in the SHP as the
   exterior ring [about 200 vertices]
- the second one has only 4 vertices (i.e. it's a triangle)
   and is almost invisible, because is incredibly small (just
   few centimeters, measured on the terrain: it looks like
   a possible artifact).
   this second ring is correctly marked in the SHP to be
   an interior ring, and shares a common point with the
   exterior ring. nothing forbids an interior ring like this,
   so GEOS correctly identifies this Polygon as a valid one.

There was a bug in the SpatiaLite's own SHP loader: on
SpatiaLite the second ring was wrongly assumed to be a second
exterior ring, thus producing a MultiPolygon (two polygons).
But the second polygon was fully contained within the main
one, thus causing GEOS to raise a geometry error.

Conclusion #1: we've found (and resolved) an obscure bug
   in SpatiaLite
Conclusion #2: GEOS surely is the better tool to be used
   in order to identify any malformed Geometry
   Highly recommended ;-)

bye Sandro

p.s.: many thanks to Pasquale, Salvatore and Strk

Il messaggio e' stato analizzato alla ricerca di virus o
contenuti pericolosi da MailScanner, ed e'
risultato non infetto.

More information about the Qgis-developer mailing list