Select to view content in your preferred language

Data Driven Page Refresh Picture

2306
1
04-12-2012 06:05 AM
SahasShrestha
Deactivated User
I'm using ArcGIS 10 SP4. I've a data driven pages and I need to update image in each page based on the attribute of grid shape file. Can anyone help me please? Thanks.
0 Kudos
1 Reply
JeffBarrette
Esri Regular Contributor
At 10.0 you will need to use arcpy.mapping to update the picture as you go from page to page.  At 10.1, we've added picture element properties that allow you to reference a field in a table.

Here is some sample code for 10.0:

import arcpy
mxd = arcpy.mapping.MapDocument(r"C:\Project\project.mxd")
pict = arcpy.mapping.ListLayoutElements(mxd, "PICTURE_ELEMENT", "photo")[0]
for pageNum in range(1, mxd.dataDrivenPages.pageCount + 1):
    mxd.dataDrivenPages.currentPageID = pageNum
    photoField = mxd.dataDrivenPages.pageRow.picture  #picture is the name of the field in the index layer
    pict.imageSource = photoField
    arcpy.mapping.ExportToPDF(mxd, r"C:\Project\OutPut\Output" + str(pageNum) + ".pdf")
del mxd
0 Kudos