Quantcast
Viewing all articles
Browse latest Browse all 13

Name file based on column information, data driven pages

I am using data driven pages to export 300 maps into PNG-files. I would like to name every exported PNG-file based on information from a column in the attribute table. What is the code for that? The code I´m using (which doesn´t work properly) is below:

mxd = arcpy.mapping.MapDocument("CURRENT")
for pageNum in range(1, mxd.dataDrivenPages.pageCount + 1):
    mxd.dataDrivenPages.currentPageID = pageNum
    arcpy.mapping.ExportToPNG(mxd, r"C:UsersDesktopa" + str(mxd.dataDrivenPages.pageNameField.name) + ".png",resolution=300)
del mxd

Viewing all articles
Browse latest Browse all 13

Trending Articles