37

I am working on ownership data at a US county level. I have one shapefile per county that contains thousands of tax parcels. I need to dissolve the polygons representing parcels owned by the same individual.

When the shapefile is not clean, the "Dissolve" tool in QGIS doesn't seem to work, it freezes. I have to fix the geometry validity issues first using the "Check Geometry Validity" tool. However, I have sometimes hundreds of errors. It takes a lot of time to fix them manually. Is there any other strategies that could save me some time?

I am using QGIS 2.4.0.

0

7 Answers 7

23

Try running a subtle buffer on the polygons. A setting of -0.001 if your CRS is UTM would seem worth a try. VECTOR|BUFFER

1
  • 4
    I tried the "Buffer" solution first suggested by BillW. It solved 97% of my issues, which is enough for me now. I can finish the job manually. Running a small buffer on the polygons won't create any problem for me down the road I believe. But I can see some cases where using ST_MakeValid or trying v.clean could be better and more accurate.
    – Bap
    Commented Sep 5, 2014 at 19:06
22

When I have a layer with errors , I normally run it through the GRASS function v.clean in the Processing Toolbox. Though I never really figured out which tool is best in which case, I normally choose the bpol function there.

Maybe even more important it is to set the advanced parameters for snap tolerance and min area. Depending on the layer, I usually choose 0.1 to 2 meters for snapping and e.g. 10 sqm for the minimum area.

The snapping e.g. aligns boundaries which are meant to be shared borders but have tiny offsets, the minimum area eliminates tiny slivers from intersections etc.

Together with the bpol, this normally resolves all errors without too much changing the topology.

11

You can use ST_MakeValid directly in QGIS adding lwgeom plugin that add lwgeom provider to processing toolbox => you can apply MakeValid directly on your loaded layer without converting in postigs/spatialite. Postgis/spatialite use the same liblwgeom to do ST_MakeValid

you have to install liblwgeom and configure processing provider to point to it

lwgeom provider can be found as experimental: https://plugins.qgis.org/plugins/processinglwgeomprovider/

2
  • 1
    Is this working with QGIS 2.18 ? Doesn't seem to work in my QGIS version, github.com/faunalia/processinglwgeomprovider
    – RutgerH
    Commented Jun 13, 2017 at 18:49
  • 1
    Just an update... since time QGIS3.x has a processing native fixgeometry algorithm that is a wrapper to the GEOS lwgeom MakeValid algorithms. No db is necessary. Commented Aug 28, 2018 at 15:41
6

Saving data into PostGIS and running ST_MakeValid could help http://postgis.refractions.net/docs/ST_MakeValid.html. Spatialite has ST_MakeValid also http://www.gaia-gis.it/gaia-sins/spatialite-sql-latest.html.

0
6

Though I know this question is for QGIS 2, anyone here looking for an answer for QGIS 3:

Processing --> Toolbox --> Vector Geometry --> Fix Geometries

Just for context, I needed to do this after I received the following error:

Feature (820) has invalid geometry. Please fix the geometry or change the Processing setting to the "Ignore invalid input features" option.
2

I just ran in to a similar problem in qgis. I had a poly began projecting incorrectly. I used the Grass fuction v.clean in the Processing toolbox as Bernd suggested. Although bpol did not work, it seems to be fixed with the break function.

0

There is a standalone utility to fix this kind of problems, and I find it to be very reliable. It is called Shapechk by Andrew Williamson.

It can be downloaded from this link: https://gis.stackexchange.com/a/7824/93912

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.