Select to view content in your preferred language

Using pageName via joined table to export Data Driven Pages to PNG or TIFF

2044
0
09-21-2011 09:56 AM
EugeneDurshpek
Occasional Contributor
To start; I'm a newbie to python and am in need of some help...

I have created several maps and have enabled data driven pages. In my maps, the data driven pages are set up based on a layer that's referencing a joined table. My pageName for data driven pages is coming from the joined table CIPProjectData_SCIP.CIPProjectID.

I'm attempting to export the series to either PNG or TIFF images and need to use the pageName from my data driven pages (CIPProjectData_SCIP.CIPProjectID) for file names of the images.

Here's what I have so far. I'm not sure what I'm missing. Do I need to create a join within my python script even if there's already a join in my mxd?

Wha'ts wronog with my syntax for pageName = ...? I've tried many different syntax variations and cannot figure out the correct syntax (if a correct one exists for this scenario). I have also tried to find help on-line and am unable to find anything similar.

Any help would be greatly appreciated.

import arcpy

arcpy.env.workspace = r"\\cvfile01\GNSVC\_Engineering\GIS_Mapping\Public Works"

mxd = arcpy.mapping.MapDocument(r"\\cvfile01\GNSVC\_Engineering\GIS_Mapping\Public Works\Capital Projects Template_SCIP_AreaMaps.mxd")
for pageNum in range(1, mxd.dataDrivenPages.pageCount + 1):
mxd.dataDrivenPages.currentPageID = pageNum
arcpy.AddMessage("Exporting TIF Map " + str(pageNum) + " of " + str(mxd.dataDrivenPages.pageCount))
pageName = mxd.dataDrivenPages.pageRow("CIPProjectData_SCIP.CIPProjectID")
arcpy.mapping.ExportToPNG(mxd, r"\\cvfile01\GNSVC\_Engineering\GIS_Mapping\Public Works\Project_Area_Maps\CIP_"+str(pageName)+".PNG")
del mxd


Thanks!

Eugene A. Durshpek | Supervisor - Asset Management & GIS
City of Vancouver
Public Works Department
eugene.durshpek@cityofvancouver.us
(360) 487-7174
www.cityofvancouver.us
Tags (2)
0 Kudos
0 Replies