Clip raster using shapefile into multiple rasters using ArcGIS Desktop?

I was trying to figure out the same thing and made this in Model Builder.

enter image description here

I am not good with scripting at all and new to model building but this was pretty easy to make and worth the effort.

Open model builder and select INSERT > Iterators > feature selection. Use the input to be your polygon shapefile that contains the 30 different polygons; hopefully they are classified differently with an attribute like name. Select the Group by fields drop down and put the name of the attribute you want to display for each individual rasters you are going to create.

Click ok, then in the Arctoolbox go to data management > raster > raster processing > Clip and just drag that tool box into your model builder window. Double click the Clip icon and input the raster you want to use. Select your output folder, then (this is the tricky part) to ensure you get 30 individual raster images type in the name %value%.tif at the end of your path location for the output.

Then click Model > Validate entire Model, then of course run entire model. It will take a while to proccess that many rasters but will certainly save time.

Last thing to change the spatial reference system click Model > Model Properties > Check Output Coordinates > Values and browse to the one you want.


If you don’t want to use Python you can use Model Builder. Model Builder has several iterator tools.

Use Iterate Feature Selection to iterate over features in a feature class (your watersheds). Then use Clip Tool.

You have to run this model 10 times (one for each raster).

Here are some examples of using serveral iterate tools.


you can loop on each polygon and perform the clip raster or extract by mask. Here is a small sample code :

import arcpy

rasterlist = arcpy.ListRasters("your_workspace")
for raster in rasterlist:
    for i in range(30):
        arcpy.MakeFeatureLayer_management("your_shapefile", "layer" + str(i), ' "FID" = ' + str(i)) #create a layer with only polygon i
        arcpy.Clip_management(raster, "#", raster[:-4] + "clip" + str(i) +" .tif","layer" + str(i), "0", "ClippingGeometry") #clip based on layer, clipping geometry will use the polygon extent only

note that you may want to use the snap raster environment to make sure that you are ligned with your original image.