Arcpy 按照要素输出地图

策略:先获得要素,然后地图缩放到对应要素,输出地图,代码如下:

import arcpy
mxd = arcpy.mapping.MapDocument(r"hubei080423.mxd")

lyr = arcpy.mapping.ListLayers(mxd)[1]
df = arcpy.mapping.ListDataFrames(mxd)[0]
rows = arcpy.SearchCursor(lyr)
for row in rows:
  geo = row.shape
  df.panToExtent(geo.extent)
  outFile = r"d:\data\\" + row.getValue("City") + ".tif"
  arcpy.mapping.ExportToJPEG(mxd, outFile, "PAGE_LAYOUT",400)

arcpy.RefreshActiveView()
arcpy.RefreshTOC()
del mxd

转载自:https://blog.csdn.net/sprintwater/article/details/39085049

You may also like...