arcpy批量裁剪栅格
# -*- coding: utf-8 -*-
import arcpy
import os
import sys
reload(sys)
sys.setdefaultencoding( "utf-8" )
input_rasters = arcpy.GetParameter(0)
clip_features = arcpy.GetParameter(1)
workpath = arcpy.GetParameterAsText(2)
output_type = arcpy.GetParameterAsText(3)
arcpy.CheckOutExtension("Spatial")
for raster in input_rasters:
for shp in clip_features:
fcdesc = arcpy.Describe(raster)
arcpy.SetProgressorLabel(fcdesc.basename + "Clip" + "...")
outputfile = os.path.join(workpath,fcdesc.basename+"Clip"+output_type)
arcpy.Clip_management(raster,'',outputfile,shp,"","ClippingGeometry")
arcpy.SetProgressorPosition()
arcpy.ResetProgressor()
将其添加到脚本工具中,界面如下:在这里插入图片描述
谢谢浏览!
转载自:https://blog.csdn.net/GISer_kaifang/article/details/88868351