<?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: Set spatial extent to arcpy.da.SerachCursor and UpdateCursor in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/set-spatial-extent-to-arcpy-da-serachcursor-and/m-p/387274#M30571</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;you can redirect your copy to in_memory if you want, if not, reuse the same filename during your process and delete when all done.&lt;/P&gt;&lt;P&gt;​&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 09 Mar 2015 04:31:27 GMT</pubDate>
    <dc:creator>DanPatterson_Retired</dc:creator>
    <dc:date>2015-03-09T04:31:27Z</dc:date>
    <item>
      <title>Set spatial extent to arcpy.da.SerachCursor and UpdateCursor</title>
      <link>https://community.esri.com/t5/python-questions/set-spatial-extent-to-arcpy-da-serachcursor-and/m-p/387273#M30570</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can I iterate through feature layer or feature class by arcpy.da.SerachCursor and arcpy.da.UpdateCursor within a certain geographic extent?&amp;nbsp; Right now I am making feature class copying the content.&amp;nbsp; Is this most efficient method?&amp;nbsp; Basically I have giant feature class, and I want to visit geographic subdivision of the feature class and then do my processing there.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;# I have a feature class.&amp;nbsp; I made it into feature layer
arcpy.MakeFeatureLayer_management(poly_fc, tmp_lyr)

# I then set extent to the part of data that I want to process
arcpy.env.extent = extent1

# if I count the feature from the layer, I got the count of feature in the extent. 
#&amp;nbsp; if I copy it into feature class I got the featueres inside the extent
n0 = int( arcpy.GetCount_management(tmp_lyr).getOutput(0)) # I got corrent n0
arcpy.CopyFeatures_management(tmp_lyr, selected_fc)&amp;nbsp; # I got fc of only the feature within extent1

# But iterating the tmp_lyr visits all featuers in tmp_lyr, ignoring the arcpy.env.extent
lst =&amp;nbsp; [ _[0] for _ in arcpy.da.SearchCursor(tmp_lyr, [&lt;A href="mailto:'SHAPE@'" rel="nofollow noopener noreferrer" target="_blank"&gt;'SHAPE@'&lt;/A&gt;])]&amp;nbsp;&amp;nbsp; 
#&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lst above contains all features, not just the one in extent

# if I access through the copied fc, I get what I want, i.e., features within the extent
lst_small =&amp;nbsp; [ _[0] for _ in arcpy.da.SearchCursor(selected_fc, [&lt;A href="mailto:'SHAPE@'" rel="nofollow noopener noreferrer" target="_blank"&gt;'SHAPE@'&lt;/A&gt;])]&amp;nbsp;&amp;nbsp; 
#&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lst_small above contains what I want

# so I just process on the copy....
with arcpy.da.SearchCursor(selected_fc, ['SHAPE@']) as cur:
&amp;nbsp; for row in cur:
&amp;nbsp;&amp;nbsp;&amp;nbsp; # my processing here...
&amp;nbsp;&amp;nbsp;&amp;nbsp; pass&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 17:47:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/set-spatial-extent-to-arcpy-da-serachcursor-and/m-p/387273#M30570</guid>
      <dc:creator>yosukekimura</dc:creator>
      <dc:date>2021-12-11T17:47:17Z</dc:date>
    </item>
    <item>
      <title>Re: Set spatial extent to arcpy.da.SerachCursor and UpdateCursor</title>
      <link>https://community.esri.com/t5/python-questions/set-spatial-extent-to-arcpy-da-serachcursor-and/m-p/387274#M30571</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;you can redirect your copy to in_memory if you want, if not, reuse the same filename during your process and delete when all done.&lt;/P&gt;&lt;P&gt;​&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Mar 2015 04:31:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/set-spatial-extent-to-arcpy-da-serachcursor-and/m-p/387274#M30571</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2015-03-09T04:31:27Z</dc:date>
    </item>
    <item>
      <title>Re: Set spatial extent to arcpy.da.SerachCursor and UpdateCursor</title>
      <link>https://community.esri.com/t5/python-questions/set-spatial-extent-to-arcpy-da-serachcursor-and/m-p/387275#M30572</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use &lt;SPAN style="font-family: courier new,courier;"&gt;arcpy.&lt;/SPAN&gt;&lt;SPAN style="color: #4d4d4d; text-indent: 0px;"&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;SelectLayerByLocation_management&lt;/SPAN&gt; first to create a selection on your feature layer, then create the search cursor.&amp;nbsp; If you are using ArcGIS 10.3 and already have an extent object created, you can pass the extent object's &lt;SPAN style="font-family: courier new,courier;"&gt;polygon&lt;/SPAN&gt; property to &lt;SPAN style="font-family: courier new,courier;"&gt;arcpy.&lt;/SPAN&gt;&lt;SPAN style="color: #4d4d4d; text-indent: 0px;"&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;SelectLayerByLocation_management&lt;/SPAN&gt;.&amp;nbsp; If you are using ArcGIS 10.2.2 or earlier, you can manually create a polygon using the extent object's bounds.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Mar 2015 14:36:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/set-spatial-extent-to-arcpy-da-serachcursor-and/m-p/387275#M30572</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2015-03-09T14:36:59Z</dc:date>
    </item>
    <item>
      <title>Re: Set spatial extent to arcpy.da.SerachCursor and UpdateCursor</title>
      <link>https://community.esri.com/t5/python-questions/set-spatial-extent-to-arcpy-da-serachcursor-and/m-p/387276#M30573</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks, all my feature/layer are in_momory now.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Mar 2015 15:39:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/set-spatial-extent-to-arcpy-da-serachcursor-and/m-p/387276#M30573</guid>
      <dc:creator>yosukekimura</dc:creator>
      <dc:date>2015-03-09T15:39:17Z</dc:date>
    </item>
    <item>
      <title>Re: Set spatial extent to arcpy.da.SerachCursor and UpdateCursor</title>
      <link>https://community.esri.com/t5/python-questions/set-spatial-extent-to-arcpy-da-serachcursor-and/m-p/387277#M30574</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is what I wanted, seems like working the way I wanted.&amp;nbsp; Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Mar 2015 16:58:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/set-spatial-extent-to-arcpy-da-serachcursor-and/m-p/387277#M30574</guid>
      <dc:creator>yosukekimura</dc:creator>
      <dc:date>2015-03-09T16:58:03Z</dc:date>
    </item>
    <item>
      <title>Re: Set spatial extent to arcpy.da.SerachCursor and UpdateCursor</title>
      <link>https://community.esri.com/t5/python-questions/set-spatial-extent-to-arcpy-da-serachcursor-and/m-p/387278#M30575</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Actually, I am having trouble with Select Layer By Location approach.&amp;nbsp; I am getting different results with two method.&amp;nbsp; I dumped what's selected into arcmap and found that setting extent and copy method selects fearues I expected, which is any features which has shared point with the extent rectangle.&amp;nbsp; Somehow method 1 failed to choose some of feature.&amp;nbsp; My questions are&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Is "INTERSECT" correct method to mimic what extent does?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;EDIT&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Looking into further, this occurred for one small polygon near the edge of the extent (but completely contained by the extent rectangle), not being selected by Select Layer By Location method, whereas setting extent and then copying features catches this one feature.&amp;nbsp; I heve everything in same sapatial reference.&amp;nbsp; The extent polygon has dimension of tens of degree (WGS84), and the feature having trouble is an rectangle of&amp;nbsp; half minute in each side, off from the extent boundary by about half minutes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am using ArcGIS 10.2.2, by the way.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;# prepare extent from precalculated corner coordinates
sr = arcpy.Describe(feat_lyr).spatialReference
myextent = arcpy.Extent( ((x0,y0), (x0,y1), (x1, y1), (x1, y0)), sr )

# Method 1, using Select By Location
arcpy.env.extent = None
geom_ext = arcpy.Polygon(arcpy.Array(
&amp;nbsp;&amp;nbsp;&amp;nbsp; [getattr( myextent, _ ) for _ in 
&amp;nbsp;&amp;nbsp;&amp;nbsp; ('lowerLeft', 'upperLeft', 'upperRight', 'lowerRight') ] )
arcpy.SelectLayerByLocation(feat_lyr, 'INTERSECT', geom_ext )
geoms1 = [row[0] for row in arcpy.SearchCursor(feat_lyr, ['SHAPE@'])]

# Method 2, copy feature
arcpy.env.extent = myextent
arcpy.CopyFeatures_management(feat_lyr, feat_fc)
geoms2 = [row[0] for row in arcpy.SearchCursor(feat_fc, ['SHAPE@'])]&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 17:47:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/set-spatial-extent-to-arcpy-da-serachcursor-and/m-p/387278#M30575</guid>
      <dc:creator>yosukekimura</dc:creator>
      <dc:date>2021-12-11T17:47:20Z</dc:date>
    </item>
    <item>
      <title>Re: Set spatial extent to arcpy.da.SerachCursor and UpdateCursor</title>
      <link>https://community.esri.com/t5/python-questions/set-spatial-extent-to-arcpy-da-serachcursor-and/m-p/387279#M30576</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Regarding spatial reference, yes, it is always a good idea to specify a spatial reference when creating ArcPy geometry objects.&amp;nbsp; There are numerous, known precision issues that crop up with ArcPy geometry objects when spatial references aren't specified.&amp;nbsp; Is lack of a spatial reference the issue here?&amp;nbsp; We will know soon enough when you test it. &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When you are talking about a "shared point with the extent rectangle," I am a bit uncertain whether that is what you mean.&amp;nbsp; "Shared point" could be taken to mean something very specific, like a polygon in question must share a vertex with the extent rectangle.&amp;nbsp; Try adding the spatial reference, and then report back.&amp;nbsp; Also, are the differences you are finding only along the periphery of the extent object?&amp;nbsp; Are any polygons more in the interior being handled different.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are 15+ different types of overlaps one can specify.&amp;nbsp; I picked Intersect in this case because it is the default and most common.&amp;nbsp; It could be the CopyFeatures_management tool uses a different overlap type, or it could be a bug in one tool or the other. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Mar 2015 23:28:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/set-spatial-extent-to-arcpy-da-serachcursor-and/m-p/387279#M30576</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2015-03-09T23:28:19Z</dc:date>
    </item>
    <item>
      <title>Re: Set spatial extent to arcpy.da.SerachCursor and UpdateCursor</title>
      <link>https://community.esri.com/t5/python-questions/set-spatial-extent-to-arcpy-da-serachcursor-and/m-p/387280#M30577</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for help!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So my extent is one giant box.&amp;nbsp; my feature having trouble in particular this time is a small rectangle sitting inside the extent rectangle.&amp;nbsp; I understand that INTERSECT, CONTAINS etc has slight difference but I understand that they both select the blue feature in the pic below.&amp;nbsp; pink is the extent polygon&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="sel_zoom.png" class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/71243_sel_zoom.png" style="width: 620px; height: 526px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The extent is a lot larger than the feature.&amp;nbsp; Below show the extent, and tiny dot near top left corner is the feature causing trouble.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="sel.png" class="image-2 jive-image" src="https://community.esri.com/legacyfs/online/71244_sel.png" style="width: 620px; height: 526px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Mar 2015 23:51:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/set-spatial-extent-to-arcpy-da-serachcursor-and/m-p/387280#M30577</guid>
      <dc:creator>yosukekimura</dc:creator>
      <dc:date>2015-03-09T23:51:03Z</dc:date>
    </item>
    <item>
      <title>Re: Set spatial extent to arcpy.da.SerachCursor and UpdateCursor</title>
      <link>https://community.esri.com/t5/python-questions/set-spatial-extent-to-arcpy-da-serachcursor-and/m-p/387281#M30578</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If I understand you correctly, it is one polygon on or near the periphery that is not being handled the way you think.&amp;nbsp; A few questions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Is the missing polygon a single-part or multi-part polygon?&lt;/LI&gt;&lt;LI&gt;You appear to be working at continental map scale, i.e., 1:60,000,000.&amp;nbsp; What spatial reference are you using?&lt;/LI&gt;&lt;LI&gt;Which part specifically isn't working?&amp;nbsp; Does the arcpy.SelectLayerByLocation_management tool miss the polygon or does that step work and it is the search cursor that is missing it?&lt;/LI&gt;&lt;LI&gt;Regarding cursors, you should really consider using the newer ArcPy Data Access (arcpy.da) cursors instead of the older/original ArcPy (arcpy) cursors.&lt;/LI&gt;&lt;/UL&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Mar 2015 01:14:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/set-spatial-extent-to-arcpy-da-serachcursor-and/m-p/387281#M30578</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2015-03-10T01:14:42Z</dc:date>
    </item>
    <item>
      <title>Re: Set spatial extent to arcpy.da.SerachCursor and UpdateCursor</title>
      <link>https://community.esri.com/t5/python-questions/set-spatial-extent-to-arcpy-da-serachcursor-and/m-p/387282#M30579</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you so much again for the help!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1.&amp;nbsp; It is a single part.&amp;nbsp; Most of features are, and this particular one definitely is.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. I am using WGS84, and everything is made to WGS84.&amp;nbsp; I figured how to set reference to arcpy.Polygon, so the extent polygon knows the spatial reference now.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. I actually tested what I am doing in my ArcMap.&amp;nbsp; Specifically, I run the script but I also exported the extent polygon, the feature class, feature layers, while I set the extent to be global first.&amp;nbsp; The image I had was showing those exported feature (shape file).&amp;nbsp; I then manually tried to select by geometry in two way.&amp;nbsp; One is from the ArcMap's tool (Selection -&amp;gt;Select By Location ...).&amp;nbsp; I also run "Select Layer By Location" tool from the tool box.&amp;nbsp; Neither of them did not select this blue feature, even though blue is included in the pink (extent).&amp;nbsp; Extent's top is 56.565833 dd, and the feature's top is 56.557500 dd , so off by 0.0833 degree (~ 0.5 minutes).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I also have a new observation.&amp;nbsp; I made the problematic feature into a feature class lone feature.&amp;nbsp; Then this select by location feature works, it picks up the feature.&amp;nbsp; But if I apply the tool to the original feature which has ~1600 features spreading across the continent, that particular feature is not selected.&amp;nbsp; The features are wide spread across the area, and each polygon is tiny in comparison to the extent.&amp;nbsp; So I am wondering ArcGIS somehow sets criteria to lower for the spatial accuracy and then this polygon got dropped somehow...?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I made three shape files, and posted here&lt;/P&gt;&lt;P&gt;&lt;A href="https://utexas.box.com/s/a6q45925jrpxzknxdp357fremtjhprhz"&gt;https://utexas.box.com/s/a6q45925jrpxzknxdp357fremtjhprhz&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It has three features, ext1, feat1 and feat1_sel.&amp;nbsp; ext1 is the extent polygon, feat1 the feature class of ~1600 features.&amp;nbsp; feat1_sel is the one having trouble.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4. sorry for the type for cursor.&amp;nbsp; I always use arcpy.da.cursor.&amp;nbsp; They should have just overwritten old&amp;nbsp; cursor.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;yosuke&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Mar 2015 03:30:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/set-spatial-extent-to-arcpy-da-serachcursor-and/m-p/387282#M30579</guid>
      <dc:creator>yosukekimura</dc:creator>
      <dc:date>2015-03-10T03:30:05Z</dc:date>
    </item>
    <item>
      <title>Re: Set spatial extent to arcpy.da.SerachCursor and UpdateCursor</title>
      <link>https://community.esri.com/t5/python-questions/set-spatial-extent-to-arcpy-da-serachcursor-and/m-p/387283#M30580</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There may be something wrong with the geometry of this one feature. Run Check Geometry or Repair Geometry on your polygons.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Mar 2015 06:52:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/set-spatial-extent-to-arcpy-da-serachcursor-and/m-p/387283#M30580</guid>
      <dc:creator>NeilAyres</dc:creator>
      <dc:date>2015-03-10T06:52:50Z</dc:date>
    </item>
    <item>
      <title>Re: Set spatial extent to arcpy.da.SerachCursor and UpdateCursor</title>
      <link>https://community.esri.com/t5/python-questions/set-spatial-extent-to-arcpy-da-serachcursor-and/m-p/387284#M30581</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for uploading data, it helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I use your data as-is, and choose Intersect_3D instead of Intersect, the polygon in question gets selected for a total of 1358.&amp;nbsp; If I project your data from WGS84 to a North American continental projection like Lamberts Conformal Conic, I get the same result.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Since using the 3D intersect option and projecting your data explicitly gets the same, expected result; I can only surmise something is going on with default values or tolerances when using geographic coordinates and a 2D intersect.&amp;nbsp; Maybe the projection-on-the-fly is having an issue, I am not sure.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Mar 2015 18:14:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/set-spatial-extent-to-arcpy-da-serachcursor-and/m-p/387284#M30581</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2015-03-10T18:14:09Z</dc:date>
    </item>
    <item>
      <title>Re: Set spatial extent to arcpy.da.SerachCursor and UpdateCursor</title>
      <link>https://community.esri.com/t5/python-questions/set-spatial-extent-to-arcpy-da-serachcursor-and/m-p/387285#M30582</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for advice.&lt;/P&gt;&lt;P&gt;I ran CheckGeometry on both extent polygon and features polygon, neither returned anything.&amp;nbsp; I ran RepearGeometry tool on both, but the symptom was the same.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Mar 2015 19:55:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/set-spatial-extent-to-arcpy-da-serachcursor-and/m-p/387285#M30582</guid>
      <dc:creator>yosukekimura</dc:creator>
      <dc:date>2015-03-10T19:55:55Z</dc:date>
    </item>
    <item>
      <title>Re: Set spatial extent to arcpy.da.SerachCursor and UpdateCursor</title>
      <link>https://community.esri.com/t5/python-questions/set-spatial-extent-to-arcpy-da-serachcursor-and/m-p/387286#M30583</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Joshua,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for taking time testing this out.&amp;nbsp; Interesting that INTERSECT_3D behave differently, but I don't know how to interpret this behavior.&amp;nbsp; I never used 3D feature in ArcGIS, and this particular feature class was created by me starting from arcpy.Polygon() based on input coordinate values I got. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The fact that making feature class of only this single problematic polygon let the ArcGIS to behave as expected make me speculate that somewhere ArcGIS is setting analysis resolution of coordinates and the extent of original feature class is so large compared distance of the polygon to extent.&amp;nbsp; But the SelectLayerByLocation doenst observe much environmental settings, maybe too dangerous for user to arbitrary set some threshold for vector data.&amp;nbsp; Hopefully in version 10.3, passing Extent object will "fix" the problem I see.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For the time being I will stick with CopyFeatures method, because it is working and robustness is more important since this is part of bigger script.&amp;nbsp;&amp;nbsp;&amp;nbsp; Part of input for my script is your employer, by the say, US Forest Service &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Mar 2015 20:16:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/set-spatial-extent-to-arcpy-da-serachcursor-and/m-p/387286#M30583</guid>
      <dc:creator>yosukekimura</dc:creator>
      <dc:date>2015-03-10T20:16:20Z</dc:date>
    </item>
    <item>
      <title>Re: Set spatial extent to arcpy.da.SerachCursor and UpdateCursor</title>
      <link>https://community.esri.com/t5/python-questions/set-spatial-extent-to-arcpy-da-serachcursor-and/m-p/387287#M30584</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am using ArcGIS 10.3, and it isn't fixed!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There is a bug with the &lt;SPAN style="font-family: courier new,courier;"&gt;arcpy.SelectLayerByLocation_management&lt;/SPAN&gt; tool.&amp;nbsp; At first I thought it might be related to using shape files, but I can generate the same issues with file geodatabases and even ArcSDE databases.&amp;nbsp; The following code demonstrates how &lt;SPAN style="font-family: courier new,courier;"&gt;arcpy.SelectLayerByLocation_management&lt;/SPAN&gt; misses the polygon while looping through a search cursor and checking for intersection gets the polygon.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;gt;&amp;gt;&amp;gt; arcpy.SelectLayerByLocation_management("xxxx_feat", "INTERSECT","xxxx_ext1", "", "NEW_SELECTION")
&amp;lt;Result 'xxxx_feat'&amp;gt;
&amp;gt;&amp;gt;&amp;gt; arcpy.GetCount_management("xxxx_feat")
&amp;lt;Result '1357'&amp;gt;
&amp;gt;&amp;gt;&amp;gt; arcpy.SelectLayerByAttribute_management("xxxx_feat","CLEAR_SELECTION")
&amp;lt;Result 'xxxx_feat'&amp;gt;
&amp;gt;&amp;gt;&amp;gt;
&amp;gt;&amp;gt;&amp;gt; i = 0
&amp;gt;&amp;gt;&amp;gt; ext = next(arcpy.da.SearchCursor("xxxx_ext1","SHAPE@"))[0]
&amp;gt;&amp;gt;&amp;gt; with arcpy.da.SearchCursor("xxxx_feat","SHAPE@") as cur:
...&amp;nbsp;&amp;nbsp;&amp;nbsp; for shape, in cur:
...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if not shape.disjoint(ext):
...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; i += 1
...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;gt;&amp;gt;&amp;gt; i
1358
&amp;gt;&amp;gt;&amp;gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The code above does raise the possibility of another approach.&amp;nbsp; If you are always selecting from the same set of features, you could build a search cursor and loop over the same cursor each time the extent object changes.&amp;nbsp; There are a couple of pluses with this approach.&amp;nbsp; One, creating a new cursor takes more resources than simply resetting one.&amp;nbsp; Two, the &lt;SPAN style="font-family: courier new,courier;"&gt;.disjoint&lt;/SPAN&gt; method is quite quick.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 17:47:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/set-spatial-extent-to-arcpy-da-serachcursor-and/m-p/387287#M30584</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2021-12-11T17:47:23Z</dc:date>
    </item>
    <item>
      <title>Re: Set spatial extent to arcpy.da.SerachCursor and UpdateCursor</title>
      <link>https://community.esri.com/t5/python-questions/set-spatial-extent-to-arcpy-da-serachcursor-and/m-p/387288#M30585</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This sounds a good work around.&amp;nbsp; It doesn't resolve the issue of Select Layer By Location, but what I wanted to do from the first place was to cycle through feature within extent.&amp;nbsp; I really don't have to select anything.&amp;nbsp; I will try this in my code see if performance is good.&amp;nbsp;&amp;nbsp; Thank you so much for all the help!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Mar 2015 20:34:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/set-spatial-extent-to-arcpy-da-serachcursor-and/m-p/387288#M30585</guid>
      <dc:creator>yosukekimura</dc:creator>
      <dc:date>2015-03-11T20:34:23Z</dc:date>
    </item>
    <item>
      <title>Re: Set spatial extent to arcpy.da.SerachCursor and UpdateCursor</title>
      <link>https://community.esri.com/t5/python-questions/set-spatial-extent-to-arcpy-da-serachcursor-and/m-p/387289#M30586</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Turns out, existing bug:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;Esri Support:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;BUG-000083370&lt;/STRONG&gt; : Select by Location does not select all features that meet the criteria. Workround - Import the extent of the Source layer into the Target layer &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To workaround this issue, you have a couple of options. The first is to create a new feature above the square that is not being selected out side of the source layer. This will force the extent of the feature class out and allow the square feature to be selected. Once the extent has been extended you can go ahead and delete the other polygon. The other option is to temporarily load the large square (xxxx_ext1) into the xxxx_feature feature class to pull out the extent. This will guarantee that the extent is correct in every direction. &lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Mar 2015 18:07:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/set-spatial-extent-to-arcpy-da-serachcursor-and/m-p/387289#M30586</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2015-03-23T18:07:13Z</dc:date>
    </item>
  </channel>
</rss>

