0

I´m currently working in this project where we are creating a time wise analysis of a certain region with many areas of interest.

We are using the data driven pages tool to address the many AOIs but we are still missing the automation part of exporting each different map (each map is from a different date).

  • 2
    Can you include a screen capture of the layer table to aid your question? – artwork21 Aug 6 '15 at 2:56
  • Here the Table of Contents: imgur.com/5pqxuRW – Julio A. López Aug 6 '15 at 17:57
  • 1
    You will have to use arcpy/python to iterate through the ddp, associate the ddp page name to the image name loaded in the map, if ddp name == image name then turn on the image, and finally export the page. You can try this out in python and post another question if you get stumped. – artwork21 Aug 6 '15 at 21:24
  • Do you know any example that I could start with. Kind of a newbie here. Thanks a lot! – Julio A. López Aug 6 '15 at 23:28
2

I just did this. Here is my code:

import arcpy
import os

for dirpath, dirnames, filenames in os.walk(u'R:\Projects\ERI\MXDs\DataDriven'):  #Walks through folder containing many different Data Driven MXDs
    for filename in filenames:
        print filename
        basePath = "R:\Projects\ERI\MXDs\DataDriven"
        mxd = basePath + "\\" + filename
        field_name = "SSN"
        mxdFile = arcpy.mapping.MapDocument(mxd)

        for i in range(1, mxdFile.dataDrivenPages.pageCount + 1):
           mxdFile.dataDrivenPages.currentPageID = i
           row = mxdFile.dataDrivenPages.pageRow
           outpath = filename.replace(".mxd", "_" + row.getValue(field_name) + ".pdf")  #Saves the file based on an attribute within the index layer.
           arcpy.mapping.ExportToPDF(mxdFile,r"R:\Projects\ERI\DataDriven_March2016\IndividualPDFs" + "\\" + outpath)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.