When I polygonize a raster, I very often have 'pixels' holes/interior ring that touche exterior ring. Example :

POLYGON((5 0, 10 0, 10 10, 0 10, 0 0, 5 0, 3 3, 5 6, 7 3, 5 0))

ring self intersection

It's defined as an invalid geometry in the OGC geometry specifications.

In QGIS, how to fix this ?


I've found the solution here but for Postgis : https://gis.stackexchange.com/a/15301/93097 and I've test it in Spatialite/Virtual layers, and it works !

Bellow the code I use with a shapefile 'my_layer' with one field 'DN' :

ST_Buffer(geometry,0.0) as geometry
FROM my_layer;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.