<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Data-Driven Pages: Dynamic Layout Element in Mapping Questions</title>
    <link>https://community.esri.com/t5/mapping-questions/data-driven-pages-dynamic-layout-element/m-p/756492#M8128</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I tried to adopt the last code &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;import arcpy&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;mxd = arcpy.mapping.MapDocument(r"K:\ArcProjects\malpaifireplan\firehistroymapbook.mxd")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;elm = arcpy.mapping.ListLayoutElements(mxd, "PICTURE_ELEMENT", "AcresBurned1")[0]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;elmX = elm.elementPositionX; elmY = elm.elementPositionY&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;elmHeight = elm.elementHeight; elmWidth = elm.elementWidth&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;for pageNum in range(1, mxd.dataDrivenPages.pageCount + 1):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;mxd.dataDrivenPages.currentPageID = pageNum&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;imageName = mxd.dataDrivenPages.pageRow.getValue("FireHistoryGraph")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;elm.sourceImage = "K:\\GIS\arcdata\malpais\jpeg\\"+ imageName&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;elm.elementPositionX = elmX; elm.elementPositionY = elmY&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;elm.elementHeight = elmHeight; elm.elementWidth = elmWidth&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;and keep getting an error message that says Runtime error &amp;lt;type 'exceptions.IOError'&amp;gt;: LayoutElementObject: Unexpected error&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is there something I am missing? I just want the image to change with each data driven page.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 25 Jan 2012 22:03:27 GMT</pubDate>
    <dc:creator>LaraMiller</dc:creator>
    <dc:date>2012-01-25T22:03:27Z</dc:date>
    <item>
      <title>Data-Driven Pages: Dynamic Layout Element</title>
      <link>https://community.esri.com/t5/mapping-questions/data-driven-pages-dynamic-layout-element/m-p/756484#M8120</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm using data driven pages to build a map book for the 50 states (i.e., my index layer). The layout of each page is identical &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;except&lt;/SPAN&gt;&lt;SPAN&gt; that on each state's page, I want an image of that state's seal. The images are all identical in size and format, they are stored in a directory, and I've appended their paths to the index layer attribute table. There doesn't appear to be a way to get them to dynamically display by using the data-driven page tools. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Anyone have any ideas on how to do this, either in combination with the ArcPy module, or by some other method?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Noah&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Jul 2010 17:52:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/data-driven-pages-dynamic-layout-element/m-p/756484#M8120</guid>
      <dc:creator>NoahBullock1</dc:creator>
      <dc:date>2010-07-22T17:52:20Z</dc:date>
    </item>
    <item>
      <title>Re: Data-Driven Pages: Dynamic Layout Element</title>
      <link>https://community.esri.com/t5/mapping-questions/data-driven-pages-dynamic-layout-element/m-p/756485#M8121</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;This is certainly do-able with arcpy. The basic algorithm would be:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1.) set up a default state seal image in your layout&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2.) loop through each page in your Data Driven Pages &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;3.) read the attribute that stores the path to the image&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;4.) change the default image path to that of the current page&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;5.) export or print the individual page (for example, export to PDF) &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;6.) if you are creating a PDF output of the map book, append all the individual state pages to a single PDF &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The DataDrivenPages class help shows how to do 2 and 3:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/DataDrivenPages/00s300000030000000/"&gt;http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/DataDrivenPages/00s300000030000000/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The PictureElement class help shows how to do 4:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/PictureElement/00s30000000s000000/"&gt;http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/PictureElement/00s30000000s000000/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The ExportToPDF function help shows how to do 5:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/ExportToPDF/00s300000027000000/"&gt;http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/ExportToPDF/00s300000027000000/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The PDFDocument class help shows how to do 6:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/PDFDocument/00s30000002w000000/"&gt;http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/PDFDocument/00s30000002w000000/&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Jul 2010 19:28:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/data-driven-pages-dynamic-layout-element/m-p/756485#M8121</guid>
      <dc:creator>JeffMoulds</dc:creator>
      <dc:date>2010-07-23T19:28:53Z</dc:date>
    </item>
    <item>
      <title>Re: Data-Driven Pages: Dynamic Layout Element</title>
      <link>https://community.esri.com/t5/mapping-questions/data-driven-pages-dynamic-layout-element/m-p/756486#M8122</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Jeff,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Need some assistance on nesting the for loop?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have an "AreaScale" field in the DDP index.&amp;nbsp; It contains path to the different image/logo required to match the DDP scale.&amp;nbsp; In my half working script below.&amp;nbsp; I'm having trouble putting the sourceImage loop inside the ExportToPDF.&amp;nbsp; Please advise?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;import arcpy&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;mxd = arcpy.mapping.MapDocument(r"C:\_rwFiles\MAPBOOK\v10\rwTest.mxd")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;for elm in arcpy.mapping.ListLayoutElements(mxd, "PICTURE_ELEMENT"):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if elm.name == "area_scale":&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fieldvalue = mxd.dataDrivenPages.pageRow.getValue("AreaScale")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; elm.sourceImage = r"" + fieldvalue&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;for pageNum in range(1, mxd.dataDrivenPages.pageCount + 1):&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; mxd.dataDrivenPages.currentPageID = pageNum&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Exporting page {0} of {1}".format(str(mxd.dataDrivenPages.currentPageID), str(mxd.dataDrivenPages.pageCount))&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.mapping.ExportToPDF(mxd, r"C:\_rwFiles\MAPBOOK\PDF\Output" + str(pageNum) + ".pdf")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;del mxd&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;This is certainly do-able with arcpy. The basic algorithm would be:&lt;BR /&gt; &lt;BR /&gt;1.) set up a default state seal image in your layout&lt;BR /&gt;2.) loop through each page in your Data Driven Pages &lt;BR /&gt;3.) read the attribute that stores the path to the image&lt;BR /&gt;4.) change the default image path to that of the current page&lt;BR /&gt;5.) export or print the individual page (for example, export to PDF) &lt;BR /&gt;6.) if you are creating a PDF output of the map book, append all the individual state pages to a single PDF &lt;BR /&gt;&lt;BR /&gt;The DataDrivenPages class help shows how to do 2 and 3:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/DataDrivenPages/00s300000030000000/"&gt;http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/DataDrivenPages/00s300000030000000/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;The PictureElement class help shows how to do 4:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/PictureElement/00s30000000s000000/"&gt;http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/PictureElement/00s30000000s000000/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;The ExportToPDF function help shows how to do 5:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/ExportToPDF/00s300000027000000/"&gt;http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/ExportToPDF/00s300000027000000/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;The PDFDocument class help shows how to do 6:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/PDFDocument/00s30000002w000000/"&gt;http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/PDFDocument/00s30000002w000000/&lt;/A&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Apr 2011 22:45:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/data-driven-pages-dynamic-layout-element/m-p/756486#M8122</guid>
      <dc:creator>RaymondWang</dc:creator>
      <dc:date>2011-04-05T22:45:34Z</dc:date>
    </item>
    <item>
      <title>Re: Data-Driven Pages: Dynamic Layout Element</title>
      <link>https://community.esri.com/t5/mapping-questions/data-driven-pages-dynamic-layout-element/m-p/756487#M8123</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am also trying to change the image based on the path in the field used to name the data driven page.&amp;nbsp; I can swap the image with a static image but I have not figured out how to access the name?&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I'll post what is not working in hopes that some python wizard can help me!&amp;nbsp; Thanks in advance.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;import arcpy&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;mxd = arcpy.mapping.MapDocument(r"B:\2011Projects\ResearchDataDrivenPageImages.mxd")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;# get the page id from the page name element&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;pageID = mxd.dataDrivenPages.getPageIDFromName("UNITID")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;mxd.dataDrivenPages.currentPageID = pageID&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;for elm in arcpy.mapping.ListLayoutElements(mxd,"PICTURE_ELEMENT"):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; if elm.name == "unit1":&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; elm.sourceImage = r"B:\2011Projects\unit" + str(pageID) + ".jpg"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; # the next line will swithc to unit2 photo without a problem&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; #elm.sourceImage = r"B:\2011Projects\unit2.jpg"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;for pageNum in range(1, mxd.dataDrivenPages.pageCount + 1):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; mxd.dataDrivenPages.currentPageID = pageNum&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; print "Exporting Page {0} of {1}".format(str(mxd.dataDrivenPages.currentPageID), str(mxd.dataDrivenPages.pageCount))&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; arcpy.mapping.ExportToPDF(mxd, r"B:\2011Projects\ResearchDataDrivenPageImages" + str(pageNum) + ".pdf")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;del mxd&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Apr 2011 15:02:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/data-driven-pages-dynamic-layout-element/m-p/756487#M8123</guid>
      <dc:creator>maryandrews</dc:creator>
      <dc:date>2011-04-19T15:02:05Z</dc:date>
    </item>
    <item>
      <title>Re: Data-Driven Pages: Dynamic Layout Element</title>
      <link>https://community.esri.com/t5/mapping-questions/data-driven-pages-dynamic-layout-element/m-p/756488#M8124</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I was able to get my script to work so I thought I would share it!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
mxd = arcpy.mapping.MapDocument(r"B:\2011Projects\ResearchDataDrivenPageImages.mxd")

for pageNum in range(1, mxd.dataDrivenPages.pageCount + 1):
&amp;nbsp; mxd.dataDrivenPages.currentPageID = pageNum
&amp;nbsp; pageName = mxd.dataDrivenPages.pageRow.getValue("UNITID")
&amp;nbsp; for elm in arcpy.mapping.ListLayoutElements(mxd,"PICTURE_ELEMENT"):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if elm.name == "unit1":
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; elm.sourceImage = ("B:\\2011Projects\\" + pageName + ".jpg")
&amp;nbsp; print "Exporting Page {0} of {1}".format(str(mxd.dataDrivenPages.currentPageID), str(mxd.dataDrivenPages.pageCount))
&amp;nbsp; arcpy.mapping.ExportToPDF(mxd, r"B:\2011Projects\ResearchDataDrivenPageImages.mxd" + str(pageNum) + ".pdf")
del mxd&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 08:05:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/data-driven-pages-dynamic-layout-element/m-p/756488#M8124</guid>
      <dc:creator>maryandrews</dc:creator>
      <dc:date>2021-12-12T08:05:19Z</dc:date>
    </item>
    <item>
      <title>Re: Data-Driven Pages: Dynamic Layout Element</title>
      <link>https://community.esri.com/t5/mapping-questions/data-driven-pages-dynamic-layout-element/m-p/756489#M8125</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Looking at the final script it does not appear the script is reading an image name (and/or path) from the index layer's attributes.&amp;nbsp; Has anyone had success with the original question of reading an attribute value of the index layer that is storing the image name and replacing the PICTURE_ELEMENT source to automatically change the image?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here's an example of my modified code trying to do this but fails to change the image:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;(The image name is stored as an attribute: image4map; all the images are located in a directory&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;(G:\NEPacific\Data-types\Vent-locations\Axial\images); the original mxd has the image named 'photo1'.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for any help!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;import arcpy&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;mxd = arcpy.mapping.MapDocument(r"G:\NEPacific\Data-types\maps\datadriven-test-map.mxd")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;mxd.dataDrivenPages.currentPageID = pageNum&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;for pageNum in range(1, mxd.dataDrivenPages.pageCount + 1):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; imageName = mxd.dataDrivenPages.pageRow.getValue("image4map")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; for elm in arcpy.mapping.ListLayoutElements(mxd,"PICTURE_ELEMENT"):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; if elm.name == "photo1":&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; elm.sourceImage = ("G:\NEPacific\Data-types\Vent-locations\Axial\images\\" + imageName)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; print "Exporting Page {0} of {1}".format(str(mxd.dataDrivenPages.currentPageID), str(mxd.dataDrivenPages.pageCount))&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; arcpy.mapping.ExportToPDF(mxd, r"G:\NEPacific\Data-types\maps\datadriven-test-map.mxd" + str(pageNum) + ".pdf")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;del mxd&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 May 2011 19:17:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/data-driven-pages-dynamic-layout-element/m-p/756489#M8125</guid>
      <dc:creator>AndraBobbitt</dc:creator>
      <dc:date>2011-05-02T19:17:15Z</dc:date>
    </item>
    <item>
      <title>Re: Data-Driven Pages: Dynamic Layout Element</title>
      <link>https://community.esri.com/t5/mapping-questions/data-driven-pages-dynamic-layout-element/m-p/756490#M8126</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;My mistake, it is reading the attribute value.&amp;nbsp; The failure in my script is in the syntax for&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;this line:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;elm.sourceImage = ("G:\NEPacific\Data-types\Vent-locations\Axial\images\\" + imageName)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Verified with print that the elm.sourceImage is set for the first image, printed the imageName&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;in the loop...just can't get the two to work together.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Still can't get it to work, any help would be great!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 May 2011 15:18:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/data-driven-pages-dynamic-layout-element/m-p/756490#M8126</guid>
      <dc:creator>AndraBobbitt</dc:creator>
      <dc:date>2011-05-03T15:18:14Z</dc:date>
    </item>
    <item>
      <title>Re: Data-Driven Pages: Dynamic Layout Element</title>
      <link>https://community.esri.com/t5/mapping-questions/data-driven-pages-dynamic-layout-element/m-p/756491#M8127</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Andra,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've looked at your code and made a few corrections to it.&amp;nbsp; The currentPageID line needs to be in the loop and I think your output filename may have caused problems.&amp;nbsp; Here is code very simily to your code.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
mxd = arcpy.mapping.MapDocument(r"C:\Temp\Photo.mxd")
for pageNum in range(1, mxd.dataDrivenPages.pageCount + 1):
&amp;nbsp; mxd.dataDrivenPages.currentPageID = pageNum
&amp;nbsp; imageName = mxd.dataDrivenPages.pageRow.getValue("image4map")
&amp;nbsp; for elm in arcpy.mapping.ListLayoutElements(mxd,"PICTURE_ELEMENT"):
&amp;nbsp;&amp;nbsp;&amp;nbsp; if elm.name == "photo1":
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; elm.sourceImage = "C:\\Temp\\" + imageName
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Exporting Page {0} of {1}".format(str(mxd.dataDrivenPages.currentPageID), str(mxd.dataDrivenPages.pageCount))
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.mapping.ExportToPDF(mxd, r"C:\Temp\\" + str(pageNum) + ".pdf")
del mxd&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Because when switching out photos, the size and positing may change so I further modified the code to elimiate extra looping and included the orginal size/positioning info that is reapplied to each new picture.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;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):
&amp;nbsp; mxd.dataDrivenPages.currentPageID = pageNum
&amp;nbsp; imageName = mxd.dataDrivenPages.pageRow.getValue("image4map")
&amp;nbsp; elm.sourceImage = "C:\\Temp\\" + imageName
&amp;nbsp; elm.elementPositionX = elmX; elm.elementPositionY = elmY
&amp;nbsp; elm.elementHeight = elmHeight; elm.elementWidth = elmWidth
&amp;nbsp; print "Exporting Page {0} of {1}".format(str(mxd.dataDrivenPages.currentPageID), str(mxd.dataDrivenPages.pageCount))
&amp;nbsp; arcpy.mapping.ExportToPDF(mxd, r"C:\Temp\\" + str(pageNum) + ".pdf")
del mxd&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I hope this helps,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Jeff&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 08:05:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/data-driven-pages-dynamic-layout-element/m-p/756491#M8127</guid>
      <dc:creator>JeffBarrette</dc:creator>
      <dc:date>2021-12-12T08:05:22Z</dc:date>
    </item>
    <item>
      <title>Re: Data-Driven Pages: Dynamic Layout Element</title>
      <link>https://community.esri.com/t5/mapping-questions/data-driven-pages-dynamic-layout-element/m-p/756492#M8128</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I tried to adopt the last code &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;import arcpy&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;mxd = arcpy.mapping.MapDocument(r"K:\ArcProjects\malpaifireplan\firehistroymapbook.mxd")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;elm = arcpy.mapping.ListLayoutElements(mxd, "PICTURE_ELEMENT", "AcresBurned1")[0]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;elmX = elm.elementPositionX; elmY = elm.elementPositionY&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;elmHeight = elm.elementHeight; elmWidth = elm.elementWidth&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;for pageNum in range(1, mxd.dataDrivenPages.pageCount + 1):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;mxd.dataDrivenPages.currentPageID = pageNum&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;imageName = mxd.dataDrivenPages.pageRow.getValue("FireHistoryGraph")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;elm.sourceImage = "K:\\GIS\arcdata\malpais\jpeg\\"+ imageName&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;elm.elementPositionX = elmX; elm.elementPositionY = elmY&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;elm.elementHeight = elmHeight; elm.elementWidth = elmWidth&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;and keep getting an error message that says Runtime error &amp;lt;type 'exceptions.IOError'&amp;gt;: LayoutElementObject: Unexpected error&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is there something I am missing? I just want the image to change with each data driven page.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Jan 2012 22:03:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/data-driven-pages-dynamic-layout-element/m-p/756492#M8128</guid>
      <dc:creator>LaraMiller</dc:creator>
      <dc:date>2012-01-25T22:03:27Z</dc:date>
    </item>
    <item>
      <title>Re: Data-Driven Pages: Dynamic Layout Element</title>
      <link>https://community.esri.com/t5/mapping-questions/data-driven-pages-dynamic-layout-element/m-p/756493#M8129</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi there, &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;We're trying to achieve the same solution (unique image on each page, with the image name tied to an attribute field), but have limited Python scripting experience. If anyone can assist with writing a script for us we would be happy to modestly compensate. Please message me and I can send you the details of how our data structure is setup.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Darren&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Feb 2012 14:57:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/data-driven-pages-dynamic-layout-element/m-p/756493#M8129</guid>
      <dc:creator>DarrenEnns</dc:creator>
      <dc:date>2012-02-06T14:57:45Z</dc:date>
    </item>
    <item>
      <title>Re: Data-Driven Pages: Dynamic Layout Element</title>
      <link>https://community.esri.com/t5/mapping-questions/data-driven-pages-dynamic-layout-element/m-p/756494#M8130</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;How would you modify the script to include 2 different images?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I got the code below to work but now I need to modify it so I can insert 2 and up to 3 different images in the data frame&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;import arcpy&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;mxd = arcpy.mapping.MapDocument(r"C:\Temp\Photo.mxd")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;elm = arcpy.mapping.ListLayoutElements(mxd, "PICTURE_ELEMENT", "photo1")[0]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;elmX = elm.elementPositionX; elmY = elm.elementPositionY&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;elmHeight = elm.elementHeight; elmWidth = elm.elementWidth&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;for pageNum in range(1, mxd.dataDrivenPages.pageCount + 1):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; mxd.dataDrivenPages.currentPageID = pageNum&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; imageName = mxd.dataDrivenPages.pageRow.getValue("image4map")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; elm.sourceImage = "C:\\Temp\\" + imageName&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; elm.elementPositionX = elmX; elm.elementPositionY = elmY&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; elm.elementHeight = elmHeight; elm.elementWidth = elmWidth&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; print "Exporting Page {0} of {1}".format(str(mxd.dataDrivenPages.currentPageID), str(mxd.dataDrivenPages.pageCount))&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; arcpy.mapping.ExportToPDF(mxd, r"C:\Temp\\" + str(pageNum) + ".pdf")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;del mxd&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any help will be greatly appreciated.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;J&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Mar 2012 15:34:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/data-driven-pages-dynamic-layout-element/m-p/756494#M8130</guid>
      <dc:creator>JuanRoubaud</dc:creator>
      <dc:date>2012-03-16T15:34:46Z</dc:date>
    </item>
    <item>
      <title>Re: Data-Driven Pages: Dynamic Layout Element</title>
      <link>https://community.esri.com/t5/mapping-questions/data-driven-pages-dynamic-layout-element/m-p/756495#M8131</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You can't "insert" pictures into a layout.&amp;nbsp; You must first author the MXD with the appropriate number of picture elements and then move them on/off the page based on the particular page.&amp;nbsp; For example:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
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&amp;nbsp; #Off the page
photo2.elementPositionX = 12&amp;nbsp; #Off the page
photo3.elementPositionX = 12&amp;nbsp; #Off the page

if page == 1: #Only 1 picture
&amp;nbsp; photo1.sourceImage = somePath
&amp;nbsp; photo1.elementPositionX = 1
&amp;nbsp; photo1.elementPositionY = 5
&amp;nbsp; photo1.elementHeight = 3
&amp;nbsp; photo1.elementWidth = 2
if page == 2: #Two pictures
&amp;nbsp; photo1.sourceImage = somePath
&amp;nbsp; photo1.elementPositionX = 4
&amp;nbsp; photo1.elementPositionY = 6
&amp;nbsp; photo1.elementHeight = 4
&amp;nbsp; photo1.elementWidth = 3
&amp;nbsp; photo2.sourceImage = somePath
&amp;nbsp; photo2.elementPositionX = 4
&amp;nbsp; photo2.elementPositionY = 6
&amp;nbsp; photo2.elementHeight = 4
&amp;nbsp; photo2.elementWidth = 3

etc
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When I deal with these dynamic situations I like to store the properties in a table.&amp;nbsp; I read the table and set the value.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I hope this is helpful,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Jeff&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 08:05:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/data-driven-pages-dynamic-layout-element/m-p/756495#M8131</guid>
      <dc:creator>JeffBarrette</dc:creator>
      <dc:date>2021-12-12T08:05:24Z</dc:date>
    </item>
    <item>
      <title>Re: Data-Driven Pages: Dynamic Layout Element</title>
      <link>https://community.esri.com/t5/mapping-questions/data-driven-pages-dynamic-layout-element/m-p/756496#M8132</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I found a way to do this without writing a script.&amp;nbsp; I created a raster catalog and loaded the photographs I wanted to show for each page.&amp;nbsp; Then, I added a field to the raster catalog table and populated it with the data driven page numbers.&amp;nbsp; Then I turned on the page definition query function for the raster catalog and placed the raster catalog in a separate data frame on my layout.&amp;nbsp; This works best when all of your pictures are the same size and shape.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Apr 2012 19:22:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/data-driven-pages-dynamic-layout-element/m-p/756496#M8132</guid>
      <dc:creator>BrookeO_Neill</dc:creator>
      <dc:date>2012-04-05T19:22:40Z</dc:date>
    </item>
    <item>
      <title>Re: Data-Driven Pages: Dynamic Layout Element</title>
      <link>https://community.esri.com/t5/mapping-questions/data-driven-pages-dynamic-layout-element/m-p/756497#M8133</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I found a way to do this without writing a script. &lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Brooke, I would really appreciate the opportunity to message or e-mail you on this item. I am a land surveyor, with only a tutorial based knowledge of GIS, and have apparently (reading this subject in the forum) set myself up for a little of a challenge with one of my first projects!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Before I realized the question had been asked and answered in several forms I posted: &lt;/SPAN&gt;&lt;A href="http://forums.arcgis.com/threads/55233-Data-Driven-Page-With-Dynamic-Image?highlight=images+data+driven"&gt;http://forums.arcgis.com/threads/55233-Data-Driven-Page-With-Dynamic-Image?highlight=images+data+driven&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The answers are well beyond my current ability, but I took hope when I read your response. If I don't find a reasonable way to complete the need I'll have to drop back to Access (exporting the one map view I need perhaps). Maybe my request is simple enough I can hire someone for some coding to finish the final image element in my data driven pages.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I look forward to hearing from you if you are available. You can message me through the forum or at rich.maher "at" gmail.com&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Rich&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 15 Apr 2012 18:29:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/data-driven-pages-dynamic-layout-element/m-p/756497#M8133</guid>
      <dc:creator>RichardMaher</dc:creator>
      <dc:date>2012-04-15T18:29:33Z</dc:date>
    </item>
    <item>
      <title>Re: Data-Driven Pages: Dynamic Layout Element</title>
      <link>https://community.esri.com/t5/mapping-questions/data-driven-pages-dynamic-layout-element/m-p/756498#M8134</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I agree with Brooke. Using a Raster Catalog with images, then using enabling the page definition query for that layer to tell it what images to use on specific pages is the way to go. This basically opens up all kinds of possiblilities to easily display any data (by converting it to a jpeg or other image, then loading it to the raster catalog) on any page.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 May 2012 14:38:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/data-driven-pages-dynamic-layout-element/m-p/756498#M8134</guid>
      <dc:creator>deleted-user-st4HsVxccxgs</dc:creator>
      <dc:date>2012-05-22T14:38:42Z</dc:date>
    </item>
    <item>
      <title>Re: Data-Driven Pages: Dynamic Layout Element</title>
      <link>https://community.esri.com/t5/mapping-questions/data-driven-pages-dynamic-layout-element/m-p/756499#M8135</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;With &lt;/SPAN&gt;&lt;STRONG&gt;10.1&lt;/STRONG&gt;&lt;SPAN&gt; you can now easily do dynamic photos with data driven pages&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//00s900000022000000"&gt;http://resources.arcgis.com/en/help/main/10.1/index.html#//00s900000022000000&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you are using Data Driven Pages you can make your picture element dynamic and have it update for each page. To do this, double-click the picture and go to the Picture tab. There are two options from which you can choose from: Simple path from Data Driven Pages and Attachment from Data Driven Pages.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 21 Jul 2013 22:21:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/data-driven-pages-dynamic-layout-element/m-p/756499#M8135</guid>
      <dc:creator>WadeLobb</dc:creator>
      <dc:date>2013-07-21T22:21:59Z</dc:date>
    </item>
  </channel>
</rss>

