I have raster data covering an entire country (say, India) and would like to split the raster image into districts. To that end, I have obtained the district level shapefile and have added it as a vector layer on top of the raster image on QGIS.

Now, to obtain the clipped raster data according to the boundary of each district in the country, it seems like I need to manually select each district in the attributes table and name that clipped data manually according to the district name. However, there are upwards of 700 districts in India and I want to do the same with about a hundred other raster images. It seems rather impractical to do this manually.

I was wondering if this could be done in a more automated way so that the software would itself clip the raster image by district and save the clipped data of each district, under the name of the district as written in the attributes table, as an image file of a suitable type. Is such a thing possible?

  • Welcome to GIS SE! We're a little different from other sites; this isn't a discussion forum but a Q&A site. Your questions should as much as possible describe not just what you want to do, but precisely what you have tried and where you are stuck trying that. Please check out our short tour for more about how the site works
    – Ian Turton
    Sep 19, 2023 at 15:26
  • Apologies! I accidentally framed my question as a discussion post. I have reframed my question to make it sound like a question rather than a discussion post. Thank you for pointing it out. Sep 20, 2023 at 12:13
  • 2
    Does this answer your question? Cropping a map into multiple pieces with QGIS
    – Cushen
    Nov 2, 2023 at 23:18

1 Answer 1

  1. Split vector layer to get a separate layer for each district (polygon feature).

  2. Run Clip Raster by Mask Layer in Batch Mode. For the output, define a path and when promted, for Autofill mode select Fill with parameter values > Mask Layer - or, to get more sophisticated options how to name the files based on attribute values, use Autofill... > Calculate by Expression...

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.