28

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.

  • 1
    Did you try to import file in grass and use v.clean? it probably will fix a lot of your errors. – Sergio Sep 4 '14 at 6:37
19

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

  • 3
    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 Sep 5 '14 at 19:06
16

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.

10

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
    I just released a new version of processinglwgeom provider to be usable with the current master version of qgis processing. (processing is under refactoring) – Luigi Pirelli Sep 6 '14 at 8:30
  • 1
    Hi @LuigiPirelli I've tried to solve a similar problem using the Lwgeom plugin, but it always crashes during the execution and I need to re-start QGis again. Is there any way I can fix this? Thanks. – Alex Fernández Poulussen Apr 10 '17 at 14:16
  • hard to say without more the running context. Btw since the 2014 there are more repair geometry instruments available in qgis. Usually a crash in lwgeom is a misalignment (dirty installation) problem in the loaded or shared object. did you test other tools? – Luigi Pirelli Apr 11 '17 at 16:53
  • Is this working with QGIS 2.18 ? Doesn't seem to work in my QGIS version, github.com/faunalia/processinglwgeomprovider – RutgerH Jun 13 '17 at 18:49
  • 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. – Luigi Pirelli Aug 28 '18 at 15:41
4

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.

1

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.

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.