bathj

Making an atlas of thematic maps with DDP

Discussion created by bathj on Sep 3, 2013
Latest reply on Sep 5, 2013 by jswis
HELP!

Trying to used arcpy and ddp to make a series of pdfs (or one large pdf) that displays five different layers turned on and off for each index feature.

I have found serveral different codes that all could be helpful, but I'm having toruble putting them together.

From http://blogs.esri.com/esri/arcgis/2010/12/14/combining-data-driven-pages-with-python-and-arcpy-mapping/
import arcpy, os

#Specify output path and final output PDF
outPath = r�?�C:MyProjectoutput\�?�
finalPdf = arcpy.mapping.PDFDocumentCreate(outPath + �??ParcelReport.pdf�?�)

#Specify the map document and the data frame
mxd = arcpy.mapping.MapDocument(r�?�C:MyProjectMyParcelMap.mxd�?�)
df = arcpy.mapping.ListDataFrames(mxd, �??Layers�?�)[0]

#Select a parcel using the LocAddress attribute and zoom to selected
parcelLayer = arcpy.mapping.ListLayers(mxd, �??Parcels�?�, df)[0]
arcpy.SelectLayerByAttribute_management(parcelLayer, �??NEW_SELECTION�?�, �??�?�LocAddress�?� = �??519 Main St�??�?�)
df.zoomToSelectedFeatures()

#Turn on visibility for each theme and export the page
lyrList = ["Soils", "Floodplains", "Zones"]
for lyrName in lyrList:
     lyr = arcpy.mapping.ListLayers(mxd, lyrName, df)[0]
     lyr.visible = True

     #Export each theme to a temporary PDF and append to the final PDF
     tmpPdf = outPath + lyrName + �??_temp.pdf�?�
     if os.path.exists(tmpPdf):
          os.remove(tmpPdf)
     arcpy.mapping.ExportToPDF(mxd, tmpPdf)
     finalPdf.appendPages(tmpPdf)
    
     #Turn off layer visibility and clean up for next pass through the loop
     lyr.visible = False
     del lyr, tmpPdf
del mxd, df, finalPdf

Will this loop through all the index features in my map?

Thanks!

Outcomes