当前位置:   article > 正文

arcgis批量出图python代码_ArcGIS批量出图、Python - 博学之www.boxuezhi.com

arcgis出图的python代码

以ArcGIS10.0为例,运动ArcGIS自带的IDLE (Python GUI),运行以下代码,可以实现指定文件夹下工作空间批量出图。代码如下(虚线中间):

---------------------------------------------------------

import arcpy, os, time

path = r'D:/试验'

res = 300

print '程序开始:' + str(time.ctime())

for afile in os.listdir(path):

if afile[-3:].lower() == 'mxd':

mxd = arcpy.mapping.MapDocument(os.path.join(path,afile))

arcpy.mapping.ExportToPDF(mxd, os.path.join(path,afile[:-3] + 'pdf'), resolution = res)

del mxd

print '程序结束:' + str(time.ctime())

----------------------------------------------------

代码第2行D:/试验'指文件夹路径;

代码第3行res = 300指分比率300ppi;

代码第8行arcpy.mapping.ExportToPDF(mxd, os.path.join(path,afile[:-3] + 'pdf'), resolution = res)指导入PDF格式图。

以下为步骤图:

d36853512677e09c8e3e391d5a624309.png

点击File-open-打开代码文件

d36853512677e09c8e3e391d5a624309.png

点击Run-Run Module F5

d36853512677e09c8e3e391d5a624309.png

d36853512677e09c8e3e391d5a624309.png

导出完成

d36853512677e09c8e3e391d5a624309.png

以上导出未经压缩,文件较大,可以用Acrobat XI Por打开另存为Adobe PDF文件(优化)(*.pdf)设置压缩

本文内容由网友自发贡献,转载请注明出处:https://www.wpsshop.cn/w/IT小白/article/detail/310832
推荐阅读
相关标签
  

闽ICP备14008679号