ryanmiller33

Data Driven Pages python help!

Discussion created by ryanmiller33 on Apr 5, 2013
Latest reply on Aug 21, 2014 by balrea
I am attempting to export a set of maps using python and data driven pages. I have been successful in getting the code to work but I am struggling with the file naming of the exported JPEG's. I need to the file names to coincide with a field in the attribute table. Basically I am making a set of parcel maps, and need the file name to be ONLY the parcel number (PARCEL_NO). Here is the code I am using. I am a novice when it comes to this stuff so please be patient. Thanks in advance!

import arcpy
mxd = arcpy.mapping.MapDocument("CURRENT")
for pageNum in range(1, mxd.dataDrivenPages.pageCount + 1):
    mxd.dataDrivenPages.currentPageID = pageNum
    pageID = mxd.dataDrivenPages.getPageIDFromName("PARCEL_NO")
    arcpy.mapping.ExportToJPEG(mxd, r"P:\Township Maps\Bloomingdale\JPEG" + pageName + ".jpeg", resolution=100)
del mxd

Outcomes