Quantcast
Channel: Forums - Python
Viewing all articles
Browse latest Browse all 2485

Export to PNG by DDP Page Name instead of PageNum

$
0
0
I am surprised that this has not been documented previously, but my search did not yield any results. Here's my question: There is sample code to export all of your data driven pages to individual PNG files with the page number at the end of the file name. How do I change the code to create file names that use the page name index value instead of the page number?

Here's the sample code:

Code:

mxd = arcpy.mapping.MapDocument("CURRENT")
... for pageNum in range(1, mxd.dataDrivenPages.pageCount + 1):
...  mxd.dataDrivenPages.currentPageID = pageNum
...  arcpy.mapping.ExportToPNG(mxd, r"C:\ArcGIS\Map_Area_" + str(pageNum) + ".png")
... del mxd


Viewing all articles
Browse latest Browse all 2485

Trending Articles