arcmap批量掩膜操作步骤
把大的影像根据矢量范围掩膜成多个影像
-- coding: gbk --
import arcpy,xlrd,os
from arcpy import env
import arcpy.cartography as CA
from arcpy.sa import ExtractByMask
infshp = r’D:\ZEHZ\SLSJ\shp\福州.shp’
image = r’D:\ZEHZ\福州.tif’
result = r’D:\ZEHZ\SLSJ\sc’
with arcpy.da.SearchCursor(infshp,[‘MC’,“SHAPE@”]) as cursor:
for row in cursor:
try:
print(row[0])
outExtractByMask = ExtractByMask(image, row[1])
outExtractByMask.save(os.path.join(result,row[0]+’.tif’))
except:
pass