4

The Union function in QGIS appears to behave erroneously.

I have two shapefiles that overlap with each other, but not within themselves. They are both valid (Vector > Geometry Tools > Check Validity), and ArcGIS Union works flawlessly on both.

However, the Union function in QGIS (Vector > Geoprocessing > Union) creates a large number of erroneous duplicates. Several of them appear to have exactly the same shape. Some don't even exclude the areas where the two shapefiles overlap.

Why is this error occurring? I have not been able to find posts that describe similar problems.

Additional Oddity

When I run the Validity Check tool (Vector > Geometry Tools > Check Validity) before conducting the Union, the polygon highlighted in the example is unionized correctly. However, the problem is not resolved, as there are now other polygons that exhibit the same error.

Resources

Shapefiles are available here

Error produced with QGIS 2.18.2 on OSX 10.11.6.

Error also occurs using QGIS 2.18.2 Python bindings on Linux servers.

Update (Sept 2018): Error does not occur in QGIS 3.2

Legend for first panel: green is first shapefile (single feature highlighted in red), light blue is second shapefile, dark blue are overlaps.

enter image description here

3
  • This would be more appropriate as a bug report than as a question on GIS.StackExchange
    – underdark
    Commented Apr 12, 2017 at 17:21
  • Confirmed. This is a bug: hub.qgis.org/issues/15962 Commented Apr 17, 2017 at 14:10
  • 1
    For what it's worth: QGIS3 doesn't have this bug anymore Commented Sep 5, 2018 at 20:03

1 Answer 1

7

Your file "25015_f_padus" is a multipart shapefile, you need to convert the file to a single part shapefile before running the union tool. Go to Vector -> Geometry tool -> Multipart to Singleparts to create single part file. Then use union tool.

Here is the final output:

enter image description here

5
  • Marked as the solution, because it resolved the issue for these files. However, just a few steps down the road, I got exactly the same error again, this time with valid single-part files - available here. Did I miss anything? Commented Apr 13, 2017 at 13:18
  • You have duplicate geometries (duplicated polygons) in 25015_f.shp and invalid geometries as some polygons overlaying each other in 25015_f_padus.shp. You need to clean these files by deleting the duplicated polygon and adjust the polygon that overlay each others. For the first one, you may need to use Delete Duplicate Geometries from Processing menu, and for the second file you may need to cut the polygon manually to remove the part that overlay the other polygon.
    – ahmadhanb
    Commented Apr 14, 2017 at 1:45
  • The error occurs even if all input files are valid, single-part, non-overlapping, non-duplicated geometries as in the files available here. BTW: I enormously appreciate your pointers, ahmadhanb. They have helped me clean my files. Unfortunately, the issue is not solved. Commented Apr 15, 2017 at 20:17
  • 1
    Finally found this. It's an unresolved bug in QGIS. hub.qgis.org/issues/15962 Commented Apr 17, 2017 at 14:11
  • I am glad you discovered the problem.
    – ahmadhanb
    Commented Apr 18, 2017 at 0:55

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.