赞
踩
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()
转载自:https://blog.csdn.net/zrli2018/article/details/53405304
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。