arcgis中mxd批量导图(tif,png,jpg,pdf)
生活随笔
收集整理的這篇文章主要介紹了
arcgis中mxd批量导图(tif,png,jpg,pdf)
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
哈嘍~大家好,因為最近工作需要把mxd中的數據導成tif格式圖片,我查了一下關于arcpy庫的相關用法并已解決批量導圖,此代碼支持導出tif,png,jpg,pdf格式,現將方法分享出來,希望能夠幫助有需要的朋友,如果此方法幫助到你麻煩點贊關注喲~
1. 打開arcgis中的IDLE(python GUI)
2.點擊File-----open;選擇要執行的代碼
3、點擊Run-----Run? Module運行代碼
等待幾秒鐘后按照提示輸入路徑、導出格式、分辨率;等待執行完成即可。
5、哈哈~終于到了最重要的一步,代碼如下,如有不足之處希望請聯系我指正喲~
# arcgis批量導圖import arcpy,ospath = raw_input('請輸入處理數據路徑:') title = raw_input('請輸入導出格式【PDF,JPEG,PNG,TIFF,GIF】:') res = int(input('請輸入導出分辨率:')) print('-------------程序開始運行--------------') count = 0 for i in os.listdir(path):if i[-3:].lower() == 'mxd' and title == 'TIFF':count += 1print('-----正在導出tif格式,第'+str(count)+'張圖片-----')mxd = arcpy.mapping.MapDocument(os.path.join(path,i))arcpy.mapping.ExportToTIFF(mxd,os.path.join(path,i[:-3] + 'tif'),resolution = res)del mxdelif i[-3:].lower() == 'mxd' and title == 'PDF':count += 1print('-----正在導出PDF格式,第'+str(count)+'張圖片-----')mxd = arcpy.mapping.MapDocument(os.path.join(path,i))arcpy.mapping.ExportToPDF(mxd,os.path.join(path,i[:-3] + 'pdf'),resolution = res)del mxdelif i[-3:].lower() == 'mxd' and title == 'JPEG':count += 1print('-----正在導出jpg格式,第'+str(count)+'張圖片-----')mxd = arcpy.mapping.MapDocument(os.path.join(path,i))arcpy.mapping.ExportToJPEG(mxd,os.path.join(path,i[:-3] + 'jpg'),resolution = res)del mxdelif i[-3:].lower() == 'mxd' and title == 'PNG':count += 1print('-----正在導出png格式,第'+str(count)+'張圖片-----')mxd = arcpy.mapping.MapDocument(os.path.join(path,i))arcpy.mapping.ExportToPNG(mxd,os.path.join(path,i[:-3] + 'png'),resolution = res)del mxdprint('-------------程序結束運行--------------')總結
以上是生活随笔為你收集整理的arcgis中mxd批量导图(tif,png,jpg,pdf)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 简单了解计算机组成原理 -- CPU与操
- 下一篇: 解决打开Excel会自动新建一个空表格