ARCPY 出图

切换数据源:

if layer.supports("DATASOURCE"):
    print "dataSource "+layer.dataSource.replace("\\", "/")
    layer.replaceDataSource(r"C:\Users\xingzz\Desktop\mappingdata\test\shp", "SHAPEFILE_WORKSPACE",
                            shotname)

shotname 一定是r”C:\Users\xingzz\Desktop\mappingdata\test\shp”这个路径中的,并且不能带有后缀!

其他文件类型也是!!

《面向ArcGIS的Python脚本编程》中187页的例子是错误的!!

 

出图语句:

arcpy.mapping.ExportToPNG(mxd, r"C:\Users\xingzz\Desktop\mappingdata\test\output\\" + shotname + ".png")

转载自:https://blog.csdn.net/huluanchushou/article/details/86098928

You may also like...