<?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 python help! in Mapping Questions</title>
    <link>https://community.esri.com/t5/mapping-questions/data-driven-pages-python-help/m-p/253049#M2703</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Only noticed PageID as a variable as I quickly scanned over code.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Good tip on correct referencing of it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Very difficult to troubleshoot other peoples problems with limited information and feedback.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Would be good to know if a solution was found.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 10 Apr 2013 21:32:06 GMT</pubDate>
    <dc:creator>CPoynter</dc:creator>
    <dc:date>2013-04-10T21:32:06Z</dc:date>
    <item>
      <title>Data Driven Pages python help!</title>
      <link>https://community.esri.com/t5/mapping-questions/data-driven-pages-python-help/m-p/253044#M2698</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am attempting to export a set of maps using python and data driven pages. I have been successful in getting the code to work but I am struggling with the file naming of the exported JPEG's. I need to the file names to coincide with a field in the attribute table. Basically I am making a set of parcel maps, and need the file name to be ONLY the parcel number (PARCEL_NO). Here is the code I am using. I am a novice when it comes to this stuff so please be patient. Thanks in advance!&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("CURRENT")
for pageNum in range(1, mxd.dataDrivenPages.pageCount + 1):
&amp;nbsp;&amp;nbsp;&amp;nbsp; mxd.dataDrivenPages.currentPageID = pageNum
&amp;nbsp;&amp;nbsp;&amp;nbsp; pageID = mxd.dataDrivenPages.getPageIDFromName("PARCEL_NO")
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.mapping.ExportToJPEG(mxd, r"P:\Township Maps\Bloomingdale\JPEG" + pageName + ".jpeg", resolution=100)
del mxd
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 12:31:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/data-driven-pages-python-help/m-p/253044#M2698</guid>
      <dc:creator>RyanMiller</dc:creator>
      <dc:date>2021-12-11T12:31:51Z</dc:date>
    </item>
    <item>
      <title>Re: Data Driven Pages python help!</title>
      <link>https://community.esri.com/t5/mapping-questions/data-driven-pages-python-help/m-p/253045#M2699</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Without seeing how your DDP is actually set up I can't be sure but you could try something like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
mxd = arcpy.mapping.MapDocument("CURRENT")
for pageNum in range(1, mxd.dataDrivenPages.pageCount + 1):
&amp;nbsp;&amp;nbsp;&amp;nbsp; mxd.dataDrivenPages.currentPageID = pageNum
&amp;nbsp;&amp;nbsp;&amp;nbsp; fieldValue = mxd.dataDrivenPages.pageRow.PARCEL_NO
&amp;nbsp;&amp;nbsp;&amp;nbsp; fieldValue = str(fieldValue)
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.mapping.ExportToJPEG(mxd, r"P:\Township Maps\Bloomingdale\JPEG" + fieldValue + ".jpeg", resolution=100)
del mxd&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 12:31:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/data-driven-pages-python-help/m-p/253045#M2699</guid>
      <dc:creator>JoelCalhoun</dc:creator>
      <dc:date>2021-12-11T12:31:54Z</dc:date>
    </item>
    <item>
      <title>Re: Data Driven Pages python help!</title>
      <link>https://community.esri.com/t5/mapping-questions/data-driven-pages-python-help/m-p/253046#M2700</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Ok sorry.&amp;nbsp; What do you need from me?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Apr 2013 18:41:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/data-driven-pages-python-help/m-p/253046#M2700</guid>
      <dc:creator>RyanMiller</dc:creator>
      <dc:date>2013-04-05T18:41:49Z</dc:date>
    </item>
    <item>
      <title>Re: Data Driven Pages python help!</title>
      <link>https://community.esri.com/t5/mapping-questions/data-driven-pages-python-help/m-p/253047#M2701</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Not sure, but you have a variable pageID, but then don't use it in code.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have substituted into code to make it look like:&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("CURRENT")
for pageNum in range(1, mxd.dataDrivenPages.pageCount + 1):
&amp;nbsp;&amp;nbsp;&amp;nbsp; mxd.dataDrivenPages.currentPageID = pageNum
&amp;nbsp;&amp;nbsp;&amp;nbsp; pageID = mxd.dataDrivenPages.getPageIDFromName("PARCEL_NO")
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.mapping.ExportToJPEG(mxd, r"P:\Township Maps\Bloomingdale\JPEG" + "\" + pageID + ".jpeg", resolution=100)
del mxd
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I also added an additional "\" to folder jpeg images under JPEG folder. You were trying to append new file to JPEG folder name.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Craig&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 12:31:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/data-driven-pages-python-help/m-p/253047#M2701</guid>
      <dc:creator>CPoynter</dc:creator>
      <dc:date>2021-12-11T12:31:56Z</dc:date>
    </item>
    <item>
      <title>Re: Data Driven Pages python help!</title>
      <link>https://community.esri.com/t5/mapping-questions/data-driven-pages-python-help/m-p/253048#M2702</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Craig,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I don't think it's a good practice to use the pageID to label your exported images since the pageID is an internal index value and my not represent what you think it does.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is the note from the help:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;&lt;BR /&gt;getPageIDFromName (page_name)&lt;BR /&gt;Parameter Explanation Data Type &lt;BR /&gt;page_name A value in the index layer that corresponds to the Name field that was used to set up Data Driven Pages&lt;BR /&gt; String &lt;BR /&gt;&lt;BR /&gt;Many of the Data Driven Pages properties and methods use an internal index value rather than the literal names of the pages used to create the index layer. The index values are automatically generated based on the Name and Sort fields. It may not be obvious which index value represents a specific page. The getPageIDFromName method provides a mechanism for this translation.&lt;BR /&gt;&lt;BR /&gt;pageID = mxd.dataDrivenPages.getPageIDFromName("HarborView")&lt;BR /&gt;mxd.dataDrivenPages.currentPageID = pageID&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In my example I pulled the parcel number straight from the table for the current page which I think is what he wanted to use as the image name but I didn't notice that JPEG was a separate folder name so that was a good catch.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Apr 2013 18:30:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/data-driven-pages-python-help/m-p/253048#M2702</guid>
      <dc:creator>JoelCalhoun</dc:creator>
      <dc:date>2013-04-10T18:30:39Z</dc:date>
    </item>
    <item>
      <title>Re: Data Driven Pages python help!</title>
      <link>https://community.esri.com/t5/mapping-questions/data-driven-pages-python-help/m-p/253049#M2703</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Only noticed PageID as a variable as I quickly scanned over code.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Good tip on correct referencing of it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Very difficult to troubleshoot other peoples problems with limited information and feedback.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Would be good to know if a solution was found.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Apr 2013 21:32:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/data-driven-pages-python-help/m-p/253049#M2703</guid>
      <dc:creator>CPoynter</dc:creator>
      <dc:date>2013-04-10T21:32:06Z</dc:date>
    </item>
    <item>
      <title>Re: Data Driven Pages python help!</title>
      <link>https://community.esri.com/t5/mapping-questions/data-driven-pages-python-help/m-p/253050#M2704</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the discussion on this!&amp;nbsp; And thank you Joel Calhoun, pageRow fixed my situation perfectly.&amp;nbsp; &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/grin.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Aug 2014 18:22:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/data-driven-pages-python-help/m-p/253050#M2704</guid>
      <dc:creator>BruceRea</dc:creator>
      <dc:date>2014-08-21T18:22:45Z</dc:date>
    </item>
  </channel>
</rss>

