ryanmiller33

Data Driven Pages and python

Discussion created by ryanmiller33 on Apr 5, 2013
Latest reply on Aug 5, 2013 by Stringtheory
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 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!


mxd = arcpy.mapping.MapDocument("CURRENT")
for pageNum in range(1, mxd.dataDrivenPages.pageCount + 1):
  mxd.dataDrivenPages.currentPageID = pageNum
  arcpy.mapping.ExportToJPEG(mxd, r"P:\Township Maps\Bloomingdale\JPEG" + str(pagename) + ".jpeg")
del mxd

Outcomes