QGIS – Solving Union Error with Multiple Overlapping Polygons

qgisshapefileunion

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

Best Answer

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

Related Question