Python工具代码,非Python窗口脚本,可以自行编辑处理一下。
# coding=gbk import arcpy from arcpy import mapping import os def main(): inFolder=arcpy.GetParameterAsText(0) outFormat=arcpy.GetParameterAsText(1).lower() resolution=arcpy.GetParameter(2) outFolder=arcpy.GetParameterAsText(3) for r,dirs,files in os.walk(inFolder): for mxdFile in files: if mxdFile[-3:].lower()=="mxd": arcpy.SetProgressorLabel(u"Exporting {}".format(mxdFile)) arcpy.AddMessage('>>>正在输出 {} 文档为图件。'.format(mxdFile)) mxd=mapping.MapDocument(os.path.join(r,mxdFile)) if outFormat=='jpg': mapping.ExportToJPEG(mxd,os.path.join(outFolder,mxdFile[:-3]+"jpg"),resolution=resolution) elif outFormat=='pdf': mapping.ExportToPDF(mxd,os.path.join(outFolder,mxdFile[:-3]+"pdf")) del mxd if __name__ == '__main__': main()
标签:__,os,mapping,JPG,mxdFile,出图,PDF,mxd,arcpy From: https://www.cnblogs.com/yzhyingcool/p/17114257.html