I need to clip a large number of scanned historical aerials by an engineering grid. For instance scan L-28 needs to be clipped by the selection of the L-28 grid from the engineering grid polygon layer. I know how to batch all the images from one grid, but how do I (can I?) batch each images from the corresponding selected polygon?
It's sounds like all you need to do is create a model with a feature selection iterator, grouping by ID, this would create a temporary in memory layer of that single polygon which would feed into a clip tool. Looking at your uploaded image I am guessing that the rasters you are showing are separate files and it is not 1 big image? You would use inline substitution to create the paths to the raster files. Don't know what that is, then you need to read the help file.
The basic model would be something very similar to below:
Has anyone figured out how to go about creating the path to the input raster files?
See if the following works for you:
import arcpy
import os
rasters = []
workspace = r"D:\test\Stowe.gdb"
walk = arcpy.da.Walk(workspace, datatype="RasterDataset")
for dirpath, dirnames, filenames in walk:
for filename in filenames:
print(filename)
rasters.append(os.path.join(dirpath, filename))
Thank you, Pavan! That short script worked.