当前位置:   article > 正文

arcgis中mxd批量导图(tif,png,jpg,pdf)_arcgis如何将cmip6数据批量转化tif

arcgis如何将cmip6数据批量转化tif

哈喽~大家好,因为最近工作需要把mxd中的数据导成tif格式图片,我查了一下关于arcpy库的相关用法并已解决批量导图,此代码支持导出tif,png,jpg,pdf格式,现将方法分享出来,希望能够帮助有需要的朋友,如果此方法帮助到你麻烦点赞关注哟~

1. 打开arcgis中的IDLE(python GUI)

2.点击File-----open;选择要执行的代码

3、点击Run-----Run  Module运行代码

等待几秒钟后按照提示输入路径、导出格式、分辨率;等待执行完成即可。

5、哈哈~终于到了最重要的一步,代码如下,如有不足之处希望请联系我指正哟~

  1. # arcgis批量导图
  2. import arcpy,os
  3. path = raw_input('请输入处理数据路径:')
  4. title = raw_input('请输入导出格式【PDF,JPEG,PNG,TIFF,GIF】:')
  5. res = int(input('请输入导出分辨率:'))
  6. print('-------------程序开始运行--------------')
  7. count = 0
  8. for i in os.listdir(path):
  9. if i[-3:].lower() == 'mxd' and title == 'TIFF':
  10. count += 1
  11. print('-----正在导出tif格式,第'+str(count)+'张图片-----')
  12. mxd = arcpy.mapping.MapDocument(os.path.join(path,i))
  13. arcpy.mapping.ExportToTIFF(mxd,os.path.join(path,i[:-3] + 'tif'),resolution = res)
  14. del mxd
  15. elif i[-3:].lower() == 'mxd' and title == 'PDF':
  16. count += 1
  17. print('-----正在导出PDF格式,第'+str(count)+'张图片-----')
  18. mxd = arcpy.mapping.MapDocument(os.path.join(path,i))
  19. arcpy.mapping.ExportToPDF(mxd,os.path.join(path,i[:-3] + 'pdf'),resolution = res)
  20. del mxd
  21. elif i[-3:].lower() == 'mxd' and title == 'JPEG':
  22. count += 1
  23. print('-----正在导出jpg格式,第'+str(count)+'张图片-----')
  24. mxd = arcpy.mapping.MapDocument(os.path.join(path,i))
  25. arcpy.mapping.ExportToJPEG(mxd,os.path.join(path,i[:-3] + 'jpg'),resolution = res)
  26. del mxd
  27. elif i[-3:].lower() == 'mxd' and title == 'PNG':
  28. count += 1
  29. print('-----正在导出png格式,第'+str(count)+'张图片-----')
  30. mxd = arcpy.mapping.MapDocument(os.path.join(path,i))
  31. arcpy.mapping.ExportToPNG(mxd,os.path.join(path,i[:-3] + 'png'),resolution = res)
  32. del mxd
  33. print('-------------程序结束运行--------------')

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/IT小白/article/detail/310846
推荐阅读
相关标签
  

闽ICP备14008679号