最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

arcgis中mxd批量导图(tif,png,jpg,pdf)

运维笔记admin12浏览0评论

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('-------------程序结束运行--------------')

发布评论

评论列表(0)

  1. 暂无评论