首页 > 代码库 > ArcGIS Python实现批量化裁剪影像
ArcGIS Python实现批量化裁剪影像
一、程序代码:
import arcpy arcpy.CheckOutExtension("spatial") arcpy.gp.overwriteOutput=1 arcpy.env.workspace = "F:\\Modis_16\\1Moasic" rasters = arcpy.ListRasters("*", "tif") mask= "F:\\Vegetation Change\\Data\\Bound\\bound_Buffer_Polygon.shp" for raster in rasters: print(raster) out= "F:\\Vegetation Change\\Data\\GIMMS Data\\new\\"+"ma_"+raster[0:8] arcpy.gp.ExtractByMask_sa(raster, mask, out) print("ma_"+raster[0:8]+" has done") print("All done")
二、注意事项:
1.arcpy.gp.overwriteOutput=1即覆盖之前的文件;
2.输入的是.tif文件,输出的是Grid文件;
3.raster[0:8]表示从第0个开始取8个字符串;
4.bound_Buffer_Plygon.shp后缀名不可或缺。
三、运行情况:
ArcGIS Python实现批量化裁剪影像
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。