I've got a raster image and I want to divide that raster by a polygon layer. There are just 7 polygons in the layer so i need to obtain 7 raster images as output. How can this done in QGIS?


If I understand you correctly, you can use the Clipper tool (Raster > Extraction > Clipper):


If you want to automate this, you can do it by creating a model or by python scripting.


Easiest thing to do is to use the Clipper function in the Raster Menu. You'll see in that there is a "clipping mode" option set and you can set it to a mask layer which will allow you to select a vector layer. You would need the 7 polygons to be in different layers though.

In the processing toolbox you will find a "clip raster by mask layer" which does roughly the same thing.

I came up with a workaround if you're looking for multiple graphical raster files (aerial photography, background mapping) clipped to vectors. I use this for providing data to third parties, but you could equally use it for extracting a WMS or for getting subdivisions of a raster. Using the atlas builder, you can cover the whole page with the map and then run the atlas builder using your vector input layer (if your vectors are irregularly shaped, set the symbology to inverted polygons. Make sure you set the output to a geotiff. I'm not sure if that will be of use to you, but it's an idea if you have lots of vectors.

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.