使用一個polygon矢量提取某個文件夾中所有的tif格式柵格數據 (要確保先安裝好arcpy包) 2019-09-02 23:53:36 ...
使用一個polygon矢量提取某個文件夾中所有的tif格式柵格數據
(要確保先安裝好arcpy包)
import arcpy
arcpy.CheckOutExtension("spatial")
arcpy.gp.overwriteOutput=1
arcpy.env.workspace = "E:\\data" #所有柵格影像所在文件夾
rasters = arcpy.ListRasters("*", "tif")
mask= "E:\\data\\bound.shp" #用於提取的矢量掩膜
for raster in rasters:
print(raster)
out= "E:\\data\\images\\"+raster
arcpy.gp.ExtractByMask_sa(raster, mask, out)
print("OK")
2019-09-02 23:53:36