《ARCGIS中Python实现批量裁剪》由会员分享,可在线阅读,更多相关《ARCGIS中Python实现批量裁剪(1页珍藏版)》请在人人文库网上搜索。
1、程序代码:pythonview plaincopyprint?1. importarcpy2. arcpy.CheckOutExtension(spatial)3. arcpy.gp.overwriteOutput=14. arcpy.env.workspace=F:Modis_161Moasic5. rasters=arcpy.ListRasters(*,tif)6. mask=F:VegetationChangeDataBoundbound_Buffer_Polygon.shp7. forrasterinrasters:8. print(raster)9. out=F:VegetationChangeDataGIMMSDatanew+ma_+raster0:810. arcpy.gp.ExtractByMask_sa(raster,mask,out)11. print(ma_+raster0:8+hasdone)12. print(Alldone)二、注意事项:1.arcpy.gp.overwriteOutput=1即覆盖之前的文件;2.输入的是.tif文件,输出的是Grid文件;3.raster0:8表示从第0个开始取8个字符串;4.bound_Buffer_Plygon.shp后缀名不可或缺。三、运行情况。