<?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: Iterate through polygons and perform Intersect in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/iterate-through-polygons-and-perform-intersect/m-p/757265#M58428</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Not a problem,&amp;nbsp;&lt;A href="https://community.esri.com/migrated-users/411493"&gt;Kathy Gillis&lt;/A&gt;‌&lt;/P&gt;&lt;P&gt;This sign # is for Priority Ranks. Refer to the link below for more info:&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://pro.arcgis.com/en/pro-app/tool-reference/analysis/priority-ranks-and-geoprocessing-tools.htm" title="https://pro.arcgis.com/en/pro-app/tool-reference/analysis/priority-ranks-and-geoprocessing-tools.htm"&gt;Priority ranks and geoprocessing tools—Help | Documentation&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 26 Jun 2020 18:13:23 GMT</pubDate>
    <dc:creator>MehdiPira1</dc:creator>
    <dc:date>2020-06-26T18:13:23Z</dc:date>
    <item>
      <title>Iterate through polygons and perform Intersect</title>
      <link>https://community.esri.com/t5/python-questions/iterate-through-polygons-and-perform-intersect/m-p/757262#M58425</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, I'm hopping for some help as I&amp;nbsp;work&amp;nbsp;through the process of writing a piece of code to produce an output of polygon intersects. My shape file contains many polygons which I would like to determine if any of them intersect and if they do add that intersect&amp;nbsp;results to a new shape file. The code I used is below. I'm getting and error which is shown in a pic below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ultimately I'd like to have a single output shape file containing&amp;nbsp;all intersect results.&amp;nbsp;If you know a more efficient way or know how to make what I have work I am all ears!&lt;/P&gt;&lt;P&gt;I have attached&amp;nbsp;a sample of the polygons.&amp;nbsp;Many thanks for your attention!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm limited to using ArcMap 10.7 and python 2.7&lt;/P&gt;&lt;P&gt;```&lt;/P&gt;&lt;P&gt;import arcpy&lt;BR /&gt;from arcpy import env&lt;BR /&gt;import os&lt;/P&gt;&lt;P&gt;##Set working directory and workspace&lt;BR /&gt;wk_dir = os.getcwd()&lt;BR /&gt;env.workspace = wk_dir&lt;/P&gt;&lt;P&gt;##Assign feature class and working fields&lt;BR /&gt;fc = wk_dir + '\\CBT_Composite.gdb\\example_polys'&lt;BR /&gt;fields = ['RecordID', &lt;A href="mailto:'SHAPE@'"&gt;'SHAPE@'&lt;/A&gt;]&lt;/P&gt;&lt;P&gt;##Assign output file path and name&lt;BR /&gt;out = wk_dir + '\\output.gdb\\A'&lt;BR /&gt;##print fc_path + fc&lt;BR /&gt;with arcpy.da.SearchCursor(fc, fields) as cursor:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in cursor:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; record = '{0}'.format(row[0]).split('.')[0]&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; polygon = row[1]&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row2 in cursor:&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; if row2 != row:&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; arcpy.Intersect_arc(row2[1], polygon, out +record)&amp;nbsp;&lt;/P&gt;&lt;P&gt;```&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;IMG alt="picture of code" class="jive-emoji image-1 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/497960_Capture.PNG" /&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="pic of error" class="image-2 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/497961_Capture2.PNG" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Jun 2020 23:12:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/iterate-through-polygons-and-perform-intersect/m-p/757262#M58425</guid>
      <dc:creator>KathyGillis</dc:creator>
      <dc:date>2020-06-25T23:12:42Z</dc:date>
    </item>
    <item>
      <title>Re: Iterate through polygons and perform Intersect</title>
      <link>https://community.esri.com/t5/python-questions/iterate-through-polygons-and-perform-intersect/m-p/757263#M58426</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;A href="https://community.esri.com/migrated-users/411493" target="_blank"&gt;Kathy Gillis&lt;/A&gt;‌,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you change the variables and run the following code you should get the intersected shapes, all in one feature class:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;env&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;workspace &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;"workspace path"&lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;analysis&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Intersect&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;"example_polys &lt;SPAN class="comment token"&gt;#", "example_polys_Intersect", "ALL", None, "INPUT")&lt;/SPAN&gt;

‍‍‍‍‍&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;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 08:06:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/iterate-through-polygons-and-perform-intersect/m-p/757263#M58426</guid>
      <dc:creator>MehdiPira1</dc:creator>
      <dc:date>2021-12-12T08:06:40Z</dc:date>
    </item>
    <item>
      <title>Re: Iterate through polygons and perform Intersect</title>
      <link>https://community.esri.com/t5/python-questions/iterate-through-polygons-and-perform-intersect/m-p/757264#M58427</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for your response Mehdi Pira!&lt;/P&gt;&lt;P&gt;Can you clarify what&amp;nbsp;' #' stands for in the Intersect statement?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you Again - Kathy&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Jun 2020 17:48:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/iterate-through-polygons-and-perform-intersect/m-p/757264#M58427</guid>
      <dc:creator>KathyGillis</dc:creator>
      <dc:date>2020-06-26T17:48:58Z</dc:date>
    </item>
    <item>
      <title>Re: Iterate through polygons and perform Intersect</title>
      <link>https://community.esri.com/t5/python-questions/iterate-through-polygons-and-perform-intersect/m-p/757265#M58428</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Not a problem,&amp;nbsp;&lt;A href="https://community.esri.com/migrated-users/411493"&gt;Kathy Gillis&lt;/A&gt;‌&lt;/P&gt;&lt;P&gt;This sign # is for Priority Ranks. Refer to the link below for more info:&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://pro.arcgis.com/en/pro-app/tool-reference/analysis/priority-ranks-and-geoprocessing-tools.htm" title="https://pro.arcgis.com/en/pro-app/tool-reference/analysis/priority-ranks-and-geoprocessing-tools.htm"&gt;Priority ranks and geoprocessing tools—Help | Documentation&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Jun 2020 18:13:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/iterate-through-polygons-and-perform-intersect/m-p/757265#M58428</guid>
      <dc:creator>MehdiPira1</dc:creator>
      <dc:date>2020-06-26T18:13:23Z</dc:date>
    </item>
    <item>
      <title>Re: Iterate through polygons and perform Intersect</title>
      <link>https://community.esri.com/t5/python-questions/iterate-through-polygons-and-perform-intersect/m-p/757266#M58429</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you! @mehdi Pira It worked perfectly. Smiling really big!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Jun 2020 21:01:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/iterate-through-polygons-and-perform-intersect/m-p/757266#M58429</guid>
      <dc:creator>KathyGillis</dc:creator>
      <dc:date>2020-06-26T21:01:16Z</dc:date>
    </item>
  </channel>
</rss>

