Using QGIS, I’m trying to merge several shp files into a larger area, the issue I’m finding is that some of these shp files contain “gaps” basically smaller polygons inside the larger one. I want to be able to bring in say 15-20 of these and want to have all the “gaps” that are overlapped by another polygon to be ignored and the ones that aren’t overlapped to remain. Here are some pictures of what I mean.

Two polygons overlapping with a true gap and two false gaps

I don’t have trouble merging the polygons and cutting the gaps out of them to create a polygon with “holes” however I’m not sure how to go about telling the program to disregard “gaps” overlapped by other polygons.

enter image description here

If I’m only dealing with two or three polygons this is easily done by hand but I’m looking at doing 20 or more way more complicated polygons to create one larger one with only actual gaps left. I'm not sure if this can be done in the program or needs a script (I'm not good at writing scripts at all).

  • Is the second image what your desired outcome would look like?
    – csk
    Nov 9, 2017 at 19:34
  • No, the second image shows the outcome i'm getting, I want an outcome with only one gap in the upper left hand corner and no gaps in the lower right hand side.
    – Elijah
    Nov 10, 2017 at 17:11
  • In the original layer, is there a hole in the large polygon where the small polygon is? Or does the small polygon overlap the large polygon?
    – csk
    Nov 13, 2017 at 16:43
  • I posted an answer based on the assumption that there are already holes in the large polygons. If not, let me know and I'll edit my answer to address that.
    – csk
    Nov 13, 2017 at 18:27

1 Answer 1


Create a new temporary scratch layer, geometry type multipolygon.

Use "Select by Expression" to select the only the large polygons.

  • Choose a number less than the area of the smallest of the large polygons, and more than the area of the largest of the small polygons.
  • Select features using the expression $area > this number

Copy the selection and paste it into the scratch layer.

Proceed with merging.

This site is temporarily in read-only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .