<?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: ArcPy &amp;amp; SelectLayerByLocation Performance in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/arcpy-amp-amp-amp-selectlayerbylocation/m-p/427545#M33608</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;What exactly do you need? Just the attribute information from the selected (identified) polygon? Will your script run within or outside of an ArcMap session? Is it based on an MXD?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 22 Jul 2011 14:33:59 GMT</pubDate>
    <dc:creator>BradPosthumus</dc:creator>
    <dc:date>2011-07-22T14:33:59Z</dc:date>
    <item>
      <title>ArcPy &amp;amp;amp; SelectLayerByLocation Performance</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-amp-amp-amp-selectlayerbylocation/m-p/427544#M33607</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I keep thinking that I must be missing something, but there does not seem to be a tool in ArcGIS 10 to select features (in particular polygons) from a layer at a point (X,Y) location via ArcPy. The parameters for such a tool would just be a layer name and an XY location.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;At the moment I workaround this by creating a point featureclass containing the point and performing a SelectLayerByLocation on it. However, when the polygon feature class is in Oracle (accessed via ArcSDE 9.x) and contains 3.5 million polygons the time taken to make the selection can be more than 5 mins when I think a second or two (with less code) would be more appropriate. The feature class has a spatial index and I've tried using arcpy.env.extent (which SelectLayerByLocation appears to ignore) to restrict the geographic area accessed but the results always seem to be the same.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is there a quicker way to do this using ArcGIS Desktop 10 and ArcPy?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;PS I've made related posts to this on &lt;/SPAN&gt;&lt;A href="http://gis.stackexchange.com/questions/12448/what-is-quickest-way-to-select-polygon-by-point-in-arcgis-10-using-arcpy"&gt;Stack Exchange &lt;/A&gt;&lt;SPAN&gt;and &lt;/SPAN&gt;&lt;A href="http://ideas.arcgis.com/ideaView?id=08730000000bq3rAAA"&gt;ArcGIS Ideas &lt;/A&gt;&lt;SPAN&gt;with no quick solutions so am beginning to think that I'm not actually missing anything.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jul 2011 22:17:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-amp-amp-amp-selectlayerbylocation/m-p/427544#M33607</guid>
      <dc:creator>GraemeBrowning</dc:creator>
      <dc:date>2011-07-21T22:17:53Z</dc:date>
    </item>
    <item>
      <title>Re: ArcPy &amp; SelectLayerByLocation Performance</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-amp-amp-amp-selectlayerbylocation/m-p/427545#M33608</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;What exactly do you need? Just the attribute information from the selected (identified) polygon? Will your script run within or outside of an ArcMap session? Is it based on an MXD?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Jul 2011 14:33:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-amp-amp-amp-selectlayerbylocation/m-p/427545#M33608</guid>
      <dc:creator>BradPosthumus</dc:creator>
      <dc:date>2011-07-22T14:33:59Z</dc:date>
    </item>
    <item>
      <title>Re: ArcPy &amp; SelectLayerByLocation Performance</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-amp-amp-amp-selectlayerbylocation/m-p/427546#M33609</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You can pass in a PointGeometry as an input, like so:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;SelectLayerByLocation(in_layer=arcpy.PointGeometry(arcpy.Point(x, y)), select_features="mylayer")&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Jul 2011 16:23:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-amp-amp-amp-selectlayerbylocation/m-p/427546#M33609</guid>
      <dc:creator>JasonScheirer</dc:creator>
      <dc:date>2011-07-22T16:23:52Z</dc:date>
    </item>
    <item>
      <title>Re: ArcPy &amp; SelectLayerByLocation Performance</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-amp-amp-amp-selectlayerbylocation/m-p/427547#M33610</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;A speedier work around might be to buffer your point a bit and then use the buffer extent as the analysis extent to make an in_memory copy (CopyFeatures tool) of your SDE data, and then do a SelectByLocation on the smaller and local in_memory dataset. That way you are sort of making the SelectByLocation tool honor the analysis extent environment, which it would not normally do. BTW: Any features that overlap with the analysis extent will be copied with the CopyFeatures tool.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I sure wish the SelectByLocation tool and the cursors methods honored the analysis extent...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Jul 2011 17:15:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-amp-amp-amp-selectlayerbylocation/m-p/427547#M33610</guid>
      <dc:creator>ChrisSnyder</dc:creator>
      <dc:date>2011-07-22T17:15:30Z</dc:date>
    </item>
    <item>
      <title>Re: ArcPy &amp; SelectLayerByLocation Performance</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-amp-amp-amp-selectlayerbylocation/m-p/427548#M33611</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm not sure this arcpy function works properly, or at least when it is exported from model builder to Python.&amp;nbsp; I exported a model which is supposed to select points within a polygon and it gives me an error that the layer is not a raster layer and not a mosaic and it fails.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;additional:&amp;nbsp; it works perfectly in model builder.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Aug 2011 23:24:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-amp-amp-amp-selectlayerbylocation/m-p/427548#M33611</guid>
      <dc:creator>PaulBillock</dc:creator>
      <dc:date>2011-08-25T23:24:55Z</dc:date>
    </item>
    <item>
      <title>Re: ArcPy &amp; SelectLayerByLocation Performance</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-amp-amp-amp-selectlayerbylocation/m-p/427549#M33612</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Paul&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;There is no guarantee that a model will just work when exported to Python script - see &lt;/SPAN&gt;&lt;A href="http://blogs.esri.com/dev/blogs/geoprocessing/archive/2011/06/24/exportmodeltopy.aspx"&gt;http://blogs.esri.com/dev/blogs/geoprocessing/archive/2011/06/24/exportmodeltopy.aspx&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you need help debugging why your exported model gives that error perhaps post some code.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;- Graeme&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Feb 2012 03:44:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-amp-amp-amp-selectlayerbylocation/m-p/427549#M33612</guid>
      <dc:creator>GraemeBrowning</dc:creator>
      <dc:date>2012-02-24T03:44:28Z</dc:date>
    </item>
    <item>
      <title>Re: ArcPy &amp; SelectLayerByLocation Performance</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-amp-amp-amp-selectlayerbylocation/m-p/427550#M33613</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Thomas&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You seem to be mixing up how to refer to layers vs datasets.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When you say: r'someLayer', it should just be someLayer (if you have already made a reference to it using ListLayers), or 'someLayer' (if there is a layer in your TOC called someLayer).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The 'r' only gets (at least by me) when dealing with backslashes in dataset paths.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;- Graeme&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 06 Apr 2013 02:29:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-amp-amp-amp-selectlayerbylocation/m-p/427550#M33613</guid>
      <dc:creator>GraemeBrowning</dc:creator>
      <dc:date>2013-04-06T02:29:33Z</dc:date>
    </item>
  </channel>
</rss>

