This is certainly do-able with arcpy. The basic algorithm would be:1.) set up a default state seal image in your layout2.) loop through each page in your Data Driven Pages 3.) read the attribute that stores the path to the image4.) change the default image path to that of the current page5.) export or print the individual page (for example, export to PDF) 6.) if you are creating a PDF output of the map book, append all the individual state pages to a single PDF The DataDrivenPages class help shows how to do 2 and 3:http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/DataDrivenPages/00s300000030000000/The PictureElement class help shows how to do 4:http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/PictureElement/00s30000000s000000/The ExportToPDF function help shows how to do 5:http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/ExportToPDF/00s300000027000000/The PDFDocument class help shows how to do 6:http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/PDFDocument/00s30000002w000000/
import arcpy mxd = arcpy.mapping.MapDocument(r"B:\2011Projects\ResearchDataDrivenPageImages.mxd") for pageNum in range(1, mxd.dataDrivenPages.pageCount + 1): mxd.dataDrivenPages.currentPageID = pageNum pageName = mxd.dataDrivenPages.pageRow.getValue("UNITID") for elm in arcpy.mapping.ListLayoutElements(mxd,"PICTURE_ELEMENT"): if elm.name == "unit1": elm.sourceImage = ("B:\\2011Projects\\" + pageName + ".jpg") print "Exporting Page {0} of {1}".format(str(mxd.dataDrivenPages.currentPageID), str(mxd.dataDrivenPages.pageCount)) arcpy.mapping.ExportToPDF(mxd, r"B:\2011Projects\ResearchDataDrivenPageImages.mxd" + str(pageNum) + ".pdf") del mxd
import arcpy mxd = arcpy.mapping.MapDocument(r"C:\Temp\Photo.mxd") for pageNum in range(1, mxd.dataDrivenPages.pageCount + 1): mxd.dataDrivenPages.currentPageID = pageNum imageName = mxd.dataDrivenPages.pageRow.getValue("image4map") for elm in arcpy.mapping.ListLayoutElements(mxd,"PICTURE_ELEMENT"): if elm.name == "photo1": elm.sourceImage = "C:\\Temp\\" + imageName print "Exporting Page {0} of {1}".format(str(mxd.dataDrivenPages.currentPageID), str(mxd.dataDrivenPages.pageCount)) arcpy.mapping.ExportToPDF(mxd, r"C:\Temp\\" + str(pageNum) + ".pdf") del mxd
import arcpy mxd = arcpy.mapping.MapDocument(r"C:\Temp\Photo.mxd") elm = arcpy.mapping.ListLayoutElements(mxd, "PICTURE_ELEMENT", "photo1")[0] elmX = elm.elementPositionX; elmY = elm.elementPositionY elmHeight = elm.elementHeight; elmWidth = elm.elementWidth for pageNum in range(1, mxd.dataDrivenPages.pageCount + 1): mxd.dataDrivenPages.currentPageID = pageNum imageName = mxd.dataDrivenPages.pageRow.getValue("image4map") elm.sourceImage = "C:\\Temp\\" + imageName elm.elementPositionX = elmX; elm.elementPositionY = elmY elm.elementHeight = elmHeight; elm.elementWidth = elmWidth print "Exporting Page {0} of {1}".format(str(mxd.dataDrivenPages.currentPageID), str(mxd.dataDrivenPages.pageCount)) arcpy.mapping.ExportToPDF(mxd, r"C:\Temp\\" + str(pageNum) + ".pdf") del mxd
photo1 = arcpy.mapping.ListLayoutElements(mxd, "PICTURE_ELEMENT", "photo1")[0] photo3 = arcpy.mapping.ListLayoutElements(mxd, "PICTURE_ELEMENT", "photo2")[0] photo2 = arcpy.mapping.ListLayoutElements(mxd, "PICTURE_ELEMENT", "photo3")[0] photo1.elementPositionX = 12 #Off the page photo2.elementPositionX = 12 #Off the page photo3.elementPositionX = 12 #Off the page if page == 1: #Only 1 picture photo1.sourceImage = somePath photo1.elementPositionX = 1 photo1.elementPositionY = 5 photo1.elementHeight = 3 photo1.elementWidth = 2 if page == 2: #Two pictures photo1.sourceImage = somePath photo1.elementPositionX = 4 photo1.elementPositionY = 6 photo1.elementHeight = 4 photo1.elementWidth = 3 photo2.sourceImage = somePath photo2.elementPositionX = 4 photo2.elementPositionY = 6 photo2.elementHeight = 4 photo2.elementWidth = 3 etc
I found a way to do this without writing a script.
Les membres connectés peuvent publier, suivre les mises à jour, et plus encore. Nouveau ici ? Inscrivez-vous gratuitement.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.