<?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: Alternative to Clipping code not working in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/alternative-to-clipping-code-not-working/m-p/204238#M15724</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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; shp = row[0]
&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;Should be&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; shp = row[1]
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 10:08:06 GMT</pubDate>
    <dc:creator>JasonScheirer</dc:creator>
    <dc:date>2021-12-11T10:08:06Z</dc:date>
    <item>
      <title>Alternative to Clipping code not working</title>
      <link>https://community.esri.com/t5/python-questions/alternative-to-clipping-code-not-working/m-p/204237#M15723</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I am trying to use the following code as an alternative to using arcpy.clip as we are finding the clip funtion very slow when using a large footprint polygon. The inFC layer is a polygon layer (very large number of polygons) and the clipFC is a single polygon.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The problem is that when I run it I get the following error:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Runtime error &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Traceback (most recent call last):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "&amp;lt;string&amp;gt;", line 16, in &amp;lt;module&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;AttributeError: 'int' object has no attribute 'disjoint'&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am a newbee at python and so am not sure why I am getting this error. I am assuming it is something to do with the clipGeom variable not being right?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;import arcpy, os, time
arcpy.env.overwriteOutput = True
print time.asctime()
inFC = r'D:\KATRIN\Data\testAllPolys.shp'
clipFC = r'D:\KATRIN\Data\testFootprint1.shp'
outFC = r'D:\KATRIN\Output\cliptest.shp'
clipGeom = [row[0] for row in arcpy.da.SearchCursor(clipFC,'Shape@')][0]
fields = ['FID','Shape@','FishingEve','TripId','GenericOct','FishingMet','TrueStatAr','cluster','TargetSpec','effort','AreaHa','EperHa','AnnualEpH']
import os
arcpy.CreateFeatureclass_management(os.path.dirname(outFC),os.path.basename(outFC),template=inFC)
inCursor = arcpy.da.InsertCursor(outFC,fields)
with arcpy.da.SearchCursor(inFC,fields) as cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row = list(row)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; shp = row[0]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if not shp.disjoint(clipGeom):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; shp = shp.intersect(clipGeom,4)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if shp.type == u'polygon':
&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; row[0] = shp
&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; inCursor.insertRow(row)
print time.asctime()&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Many thanks&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Jan 2014 00:54:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/alternative-to-clipping-code-not-working/m-p/204237#M15723</guid>
      <dc:creator>AlexThompson</dc:creator>
      <dc:date>2014-01-24T00:54:41Z</dc:date>
    </item>
    <item>
      <title>Re: Alternative to Clipping code not working</title>
      <link>https://community.esri.com/t5/python-questions/alternative-to-clipping-code-not-working/m-p/204238#M15724</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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; shp = row[0]
&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;Should be&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; shp = row[1]
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 10:08:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/alternative-to-clipping-code-not-working/m-p/204238#M15724</guid>
      <dc:creator>JasonScheirer</dc:creator>
      <dc:date>2021-12-11T10:08:06Z</dc:date>
    </item>
  </channel>
</rss>

