ARCGIS中Python实现按属性字段批量掩膜提取
import arcpy
import string
from arcpy.sa import *
try:
raster = arcpy.GetParameterAsText(0)
clip_feat = arcpy.GetParameterAsText(1)
field = arcpy.GetParameterAsText(2)
outworkspace = arcpy.GetParameterAsText(3)
for row in arcpy.SearchCursor(clip_feat):
mask=row.getValue("Shape")
outPath=outworkspace+"\\"+str(row.getValue(field))
outExtractByMask = ExtractByMask(raster,mask)
outExtractByMask.save(outPath)
except arcpy.ExecuteError:
print arcpy.GetMessages()