Hi, Been stuck on this for a few hours wondering if anything can point me in the right direction, I am pretty new to Python.
What I have is 2 data frames in an MXD. 1 data frame is controlled using data drive pages and the other frame is controlled using bookmarks (has no spatial reference). There are 30+ pages and I have to export each one manually changing book mark to pg1,pg2, pg3..etc and my data driven pages to pg1, pg2, pg3 etc. I am trying to write a python script which will change the data drive page when it changes the bookmark and exports at each loop e.g bookmark pg1 and data drive page pg1 on same page.
This is as far as I have managed to get today:
Any help would be much appreciated.
code:
What I have is 2 data frames in an MXD. 1 data frame is controlled using data drive pages and the other frame is controlled using bookmarks (has no spatial reference). There are 30+ pages and I have to export each one manually changing book mark to pg1,pg2, pg3..etc and my data driven pages to pg1, pg2, pg3 etc. I am trying to write a python script which will change the data drive page when it changes the bookmark and exports at each loop e.g bookmark pg1 and data drive page pg1 on same page.
This is as far as I have managed to get today:
Any help would be much appreciated.
code:
Code:
import arcpy
mxd = arcpy.mapping.MapDocument("CURRENT")
df = arcpy.mapping.ListDataFrames(mxd, "Cross Section")[0]
for bkmk in arcpy.mapping.ListBookmarks(mxd, data_frame=df):
df.extent = bkmk.extent
for pageNum in range(1, mxd.dataDrivenPages.pageCount + 1):
mxd.dataDrivenPages.currentPageID = pageNum
arcpy.mapping.ExportToPNG(mxd, r"D:\\" + str(pageNum) + bkmk.name + ".png")
del mxd