Advertisement
lentil

Data Driven Pages

Oct 28th, 2015
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.65 KB | None | 0 0
  1. mxd = arcpy.mapping.MapDocument("CURRENT")
  2.  
  3. #Change "CURRENT"  to a path if not run in ArcMap.  Then list all the data frames
  4.  
  5. dfs = arcpy.mapping.ListDataFrames(mxd)
  6.  
  7.  
  8.  
  9. ddp = mxd.dataDrivenPages
  10. parentDF = ddp.dataFrame
  11.  
  12. #Next step is to pan the other data frames to the extent of the parent data frame's extent.
  13.  
  14.  
  15. for pageNum in range(1, ddp.pageCount + 1):
  16.  
  17.    for df in dfs:
  18.       ddp.currentPageID = pageNum
  19.       row = ddp.pageRow
  20.       extent = row.Shape.extent
  21.       if (df.name == parentDF.name) and (df.scale == parentDF.scale):
  22.          df.panToExtent(extent)
  23.    arcpy.mapping.ExportToPNG(mxd, r"C:\\Test_DDP\\" + str(pageNum) + ".png")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement