当前位置:   article > 正文

arcpy批量按掩膜提取(用矢量裁剪栅格)_掩膜提取后转矢量

掩膜提取后转矢量

环境 arcgis10.2

# -*- coding: cp936 -*-
import arcpy
import os
arcpy.CheckOutExtension("spatial")
arcpy.gp.overwriteOutput=1
#所有shp
arcpy.env.workspace = u"F:\\shp\\xianshi"  
#裁剪栅格
raster = r"C:\Users\ZhangWH\Documents\ArcGIS\Default.gdb\Extract_re121"

masks= arcpy.ListFeatureClasses()  
#arcpy.AddMessage(masks)
for mask in masks:
    (filepath, fullname) = os.path.split(mask)
    (prename, suffix) = os.path.splitext(fullname)
    out= u"F:\\ndvi\\ex\\"+prename
    arcpy.gp.ExtractByMask_sa(raster, mask, out)
print("OK")
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
import arcpy
arcpy.CheckOutExtension("spatial")
arcpy.gp.overwriteOutput=1
arcpy.env.workspace = "F:\\20200708草地规划\\草地资源所需资料\\ndvi"  
#裁剪栅格
rasters = arcpy.ListRasters("*", "tif")
arcpy.AddMessage(rasters)
#裁剪shp
mask= "F:\20200708草地规划\ndvi\caodi.shp"  
for raster in rasters:
    print(raster)
    out= "F:\\20200708草地规划\\草地资源所需资料\\ndvi\\ex\\"+raster
    arcpy.gp.ExtractByMask_sa(raster, mask, out)
print("OK")
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家小花儿/article/detail/81117
推荐阅读
相关标签
  

闽ICP备14008679号