I work in a mixed open/closed-source GIS office where we have both open source (QGIS, and soon PostGIS) and Esri (ArcMap, ArcGIS Pro) available.

I bring in OpenStreetMap regularly and have to fix the polygon layer because of illegal geometries. Typically I do this by casting the data to a shapefile and then running Esri's Repair Geometry function. Reasonably fast and efficient. But I would like an open-source version of doing the same thing.

Before this question is marked as a duplicate, I did review:

Repairing geometry using QGIS? (I don't have a few errors, I have many thousands; thus I want to avoid the GUI in favor of CLI, plus GRASS is not working right in my version and I have no access to v.clean (Boundless Desktop 1.0)), and

Fixing geometry validity errors in QGIS? (liblwgeom processing plugin seems like it would meet my needs but there is no clear explanation of "Here is how you find the path to liblwgeom on Windows, once you install the plugin.")

I would like to use SpatiaLite's MakeValid() function but our version of QGIS does not contain it. So instead I am trying to do a Buffer() of zero, and outputting that to a new spatial table in the same SpatiaLite db.

I get that this brushes up against SE rules but I have no real starting code. When I try to use either Qspatialite plugin or the QGIS Database Manager to write:

(this is in the Qspatialite plugin SQL screen, setting Option to "Create Spatial Table & Load in QGIS):

Buffer( "multipolygons".'GEOMETRY', 0)

it gives me this response:

The SQL query seems to be invalid.
near "Buffer": syntax error

I get that it's a syntax error, but I have not found any resources for those of us who are not DBAs already, that bridge the gap between SpatiaLite documentation (theoretical) and the QGIS SQL window(s) (working with your own real data).

My desired end result is a permanent spatial table of the corrected polygon layer.

1 Answer 1


Have you tested the Geometry Checker Plugin? It's installed by default (but maybe not activate).


  • Yes. This works for ten or so errors, but doesn't automatically fix anything. It only sets up a queue of errors for me to fix manually. I was able to get GRASS working but v.clean takes hours compared to ArcMap's Repair Geometry, which takes 8 MINUTES, and in 32-bit space.
    – auslander
    Commented Jul 24, 2017 at 19:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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