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).

4
  • 2
    Can you include a screen capture of the layer table to aid your question?
    – artwork21
    Commented Aug 6, 2015 at 2:56
  • Here the Table of Contents: imgur.com/5pqxuRW Commented Aug 6, 2015 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
    Commented Aug 6, 2015 at 21:24
  • Do you know any example that I could start with. Kind of a newbie here. Thanks a lot! Commented Aug 6, 2015 at 23:28

1 Answer 1

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 and acknowledge you have read our privacy policy.

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