I want to clip a hole into a shapefile. The underlaying shapefile (greenish) consists of many polygons. The overlaying (red) is only one polygon. first image

When I use the clip tool I get this

second image

or this result (depending on the order of the input shapes for the clip tool).

third image

What I need is basically a hole in the underlaying polygin in the shape of the red polygon. Like on the first images, where there is white underneath the green polygon. What am I doing wrong?


You need to use the Difference tool. The clip tool acts like a cookie cutter, the product being whatever is under the polygon use to clip with. The difference tool will remove the top layer form the bottom layer. Set your green layer as input layer, and red layer as difference layer and the product will be your green layer with nice big hole in it.

  • I was pretty sure I tried that. Anyway, it worked now. Thanks! – Stophface Nov 3 '16 at 13:23

I know this question has accepted answer already but wanted to add how to create a hole on one vector layer from another vector layer with python using the osgeo.ogr library/Bindings.


You have two layers and w ant to create a hole in one of the layers(assuming layer1 and layer2).


The Clip method returns a layer that has attribute from both layers which is not what you want.

#create empty result layer ogrGeometryType = ogr.Geometry(ogr.wkbPolygon) outDs = driver.CreateDataSource('clip2_test.shp') outLayer = outDs.CreateLayer('clip2_test.shp', geom_type=ogrGeometryType)

layer1.Clip(layer2, outLayer)


layer1.Intersection(layer2, outLayer)


Instead, use Erase method that takes the same arguments but creates a hole and returns a layer with a hole.

To create a hole in layer1 using layer2.

layer1.Erase(layer2, outLayer)

The clip tool is the wrong took to be using for this. You'll want to use the Symmetrical Difference tool. This tool is found in the Vector > Geoprocessing Tools menu where the Clip tool is found. It creates an area based on the non-overlapping areas of the two input files. You can read more about the editing geoprocessing tools available in QGIS here.

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.