<?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: Map for each row in a shapefile with Python  in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/map-for-each-row-in-a-shapefile-with-python/m-p/227658#M17656</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;not python but could DDP be used?&amp;nbsp;&lt;A class="link-titled" href="https://support.esri.com/en/technical-article/000011376" title="https://support.esri.com/en/technical-article/000011376"&gt;How To: Hide features in Data Driven Pages so only the feature of interest is visible&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 17 May 2020 10:28:48 GMT</pubDate>
    <dc:creator>DavidPike</dc:creator>
    <dc:date>2020-05-17T10:28:48Z</dc:date>
    <item>
      <title>Map for each row in a shapefile with Python</title>
      <link>https://community.esri.com/t5/python-questions/map-for-each-row-in-a-shapefile-with-python/m-p/227657#M17655</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, I would like to know if it's possible to create&amp;nbsp;in Python a script which for each record (row) in a shapefile (TYPE:point), the script return a map with the single point. I know how exporting maps with shapefile's points all showed, but I would like to see in each map only one point for time. I tried to do a script with definition query inside a for cycle but it didn't work!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 May 2020 17:19:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/map-for-each-row-in-a-shapefile-with-python/m-p/227657#M17655</guid>
      <dc:creator>MarcoPignatiello</dc:creator>
      <dc:date>2020-05-15T17:19:17Z</dc:date>
    </item>
    <item>
      <title>Re: Map for each row in a shapefile with Python</title>
      <link>https://community.esri.com/t5/python-questions/map-for-each-row-in-a-shapefile-with-python/m-p/227658#M17656</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;not python but could DDP be used?&amp;nbsp;&lt;A class="link-titled" href="https://support.esri.com/en/technical-article/000011376" title="https://support.esri.com/en/technical-article/000011376"&gt;How To: Hide features in Data Driven Pages so only the feature of interest is visible&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 17 May 2020 10:28:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/map-for-each-row-in-a-shapefile-with-python/m-p/227658#M17656</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2020-05-17T10:28:48Z</dc:date>
    </item>
    <item>
      <title>Re: Map for each row in a shapefile with Python</title>
      <link>https://community.esri.com/t5/python-questions/map-for-each-row-in-a-shapefile-with-python/m-p/227659#M17657</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your answer. I have this shapefile&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/492671_pastedImage_2.png" /&gt;&amp;nbsp;and I would like to see n maps with only 1 point for each map.&amp;nbsp;I try with DDT script and it renturns me n maps but with all points in each. The question is: Is it possible to do an iterete definition query based on the Field (FID)??&amp;nbsp; this field is a numerical field so I think it would be possible to do a for loop setting first FID=0, then FID=1.etc.. but I don't know how I can do it.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your help!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 May 2020 15:53:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/map-for-each-row-in-a-shapefile-with-python/m-p/227659#M17657</guid>
      <dc:creator>MarcoPignatiello</dc:creator>
      <dc:date>2020-05-18T15:53:40Z</dc:date>
    </item>
    <item>
      <title>Re: Map for each row in a shapefile with Python</title>
      <link>https://community.esri.com/t5/python-questions/map-for-each-row-in-a-shapefile-with-python/m-p/227660#M17658</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't think the index field can be a number, maybe add a new field and copy the number as a string?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;what does your script look like?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 May 2020 16:10:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/map-for-each-row-in-a-shapefile-with-python/m-p/227660#M17658</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2020-05-18T16:10:12Z</dc:date>
    </item>
    <item>
      <title>Re: Map for each row in a shapefile with Python</title>
      <link>https://community.esri.com/t5/python-questions/map-for-each-row-in-a-shapefile-with-python/m-p/227661#M17659</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;#Set variable&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;BR /&gt;shp=arcpy.mapping.Layer(r"C:\Users\Utente\Dropbox (Geomatica_DSFTA)\Admin (L)\Amiata_Via_Remedi\GIS\shp\Elementi_20200508_v2.shp")&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;#Enable DDP and do this for loop&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;BR /&gt;for pageNum in range(1, mxd.dataDrivenPages.pageCount + 1):&lt;BR /&gt;&amp;nbsp;mxd.dataDrivenPages.currentPageID = pageNum&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;#I thought with to create a loop like this but it doesnt work. For sure this is not the correct way to do it&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;for a in range (1,174):&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;shp.definitionQuery='"NUM"='"a"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;arcpy.mapping.ExportToPNG(mxd, r"C:\Users\Utente\Desktop\OUTPUT\map” + str(pageNum) + ".png")&lt;BR /&gt; del mxd&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 May 2020 07:09:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/map-for-each-row-in-a-shapefile-with-python/m-p/227661#M17659</guid>
      <dc:creator>MarcoPignatiello</dc:creator>
      <dc:date>2020-05-19T07:09:04Z</dc:date>
    </item>
    <item>
      <title>Re: Map for each row in a shapefile with Python</title>
      <link>https://community.esri.com/t5/python-questions/map-for-each-row-in-a-shapefile-with-python/m-p/227662#M17660</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The loop certainly looks wrong, why the 2 assignment operators? looks to be in the wrong place but can't tell the indentation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;please refer to &lt;A href="https://community.esri.com/migrated-users/3116"&gt;Dan Patterson&lt;/A&gt;‌ 's code formatting guide&amp;nbsp;&lt;A href="https://community.esri.com/blogs/dan_patterson/2016/08/14/script-formatting"&gt;/blogs/dan_patterson/2016/08/14/script-formatting&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 May 2020 07:18:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/map-for-each-row-in-a-shapefile-with-python/m-p/227662#M17660</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2020-05-19T07:18:10Z</dc:date>
    </item>
    <item>
      <title>Re: Map for each row in a shapefile with Python</title>
      <link>https://community.esri.com/t5/python-questions/map-for-each-row-in-a-shapefile-with-python/m-p/227663#M17661</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;mxd&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;mapping&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;MapDocument&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"CURRENT"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;#Set variable&lt;/SPAN&gt;
shp&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;mapping&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Layer&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;r&lt;SPAN class="string token"&gt;"C:\Users\Utente\Dropbox (Geomatica_DSFTA)\Admin (L)\Amiata_Via_Remedi\GIS\shp\Elementi_20200508_v2.shp"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;#Enable DDP and do this for loop&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; pageNum &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; range&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; mxd&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;dataDrivenPages&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;pageCount &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
	mxd&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;dataDrivenPages&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;currentPageID &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; pageNum

&lt;SPAN class="comment token"&gt;#I thought with to create a loop like this but it doesnt work. For sure this is not the correct way to do it&lt;/SPAN&gt;
	&lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; a &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; range &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;174&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
		shp&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;definitionQuery&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'"NUM"='&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"a"&lt;/SPAN&gt;
	
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;mapping&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ExportToPNG&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;mxd&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;"C:\Users\Utente\Desktop\OUTPUT\map” + str(pageNum) + "&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;png"&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;del&lt;/SPAN&gt; mxd‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;NUM= Field of shapefile, TYPE: short integer, from 0 to 174&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I assign 2&amp;nbsp;&lt;SPAN style="background-color: #ffffff;"&gt;assignment operators (shp.definitionQuery='"NUM"='"a") because I want 174 maps where in the first map show only the point that corrisponding a NUM=1, then I want the same thing but NUM=2 till the end NUM=174. I dont know if its possible, I'm a beginner as a "programmer"&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 11:05:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/map-for-each-row-in-a-shapefile-with-python/m-p/227663#M17661</guid>
      <dc:creator>MarcoPignatiello</dc:creator>
      <dc:date>2021-12-11T11:05:40Z</dc:date>
    </item>
  </channel>
</rss>

