AnsweredAssumed Answered

Data Driven Pages Naming Issue

Question asked by Entsika_Liesl on Oct 17, 2018
Latest reply on Oct 17, 2018 by Dan_Patterson

Hi All, 

 

I am new to python, and have been using data driven pages to export multiple maps. However, I would like to change the way I'm naming my maps. Currently it is the custom name + the page name that is linked to the data driven pages.See script below:

 

mxd = arcpy.mapping.MapDocument("CURRENT")
... df = arcpy.mapping.ListDataFrames(mxd)[0]
...
... in_folder = arcpy.GetParameterAsText(0)
... file_name = arcpy.GetParameterAsText(1)
...
... for pageNum in range(1, mxd.dataDrivenPages.pageCount + 1):
... mxd.dataDrivenPages.currentPageID = pageNum
... pageName = mxd.dataDrivenPages.pageRow.Name
... arcpy.mapping.ExportToJPEG(mxd, r"C:\Users\LiesldeSwardt\Maps\NR Maps\2D_" + pageName + ".jpeg", resolution=250)
... del mxd
... del df

 

So basically it currently names: 2D_Pretoria of which Pretoria is the pageRow and 2D is my custom name whereas I would like it to name as: Pretoria_2D. I hope this makes sense, any help would be appreciated.

Outcomes