<?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: Optimizing SelectLayerByLocation_management? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/optimizing-selectlayerbylocation-management/m-p/156798#M12081</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Max extent (in Web Mercator Aux Sphere spatial ref): 40,000 acres&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My initial recommendation was to re-work the point feature class for those larger scales so as to reduce the density, and ultimately the processing times for the Selection.&amp;nbsp; But I hoped to fully vet this out before going down that road. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I look at the AGS logs, all seems to process ok 200 codes with this published GP service.&amp;nbsp; Looking at developer tools, it says about 225,000 milliseconds or about 3.75 mins to process that 40k acre polygon on points selection.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 28 Jun 2016 13:58:41 GMT</pubDate>
    <dc:creator>JamesCrandall</dc:creator>
    <dc:date>2016-06-28T13:58:41Z</dc:date>
    <item>
      <title>Optimizing SelectLayerByLocation_management?</title>
      <link>https://community.esri.com/t5/python-questions/optimizing-selectlayerbylocation-management/m-p/156796#M12079</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm looking for any alternatives to enhancing an existing SelectByLocation process.&amp;nbsp; The most optimized/best performer so far has been to simply put a FeatureLayer and a FeatureClass into an INTERSECT as parameters in an arcpy.SelectByLocation_management method.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1 polygon in the selection feature class (an in_memory FC). &lt;/P&gt;&lt;P&gt;&amp;gt;10million points in a target point feature layer (a FC in a FGDB on a network location registered with ArcGIS Server)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The extent of the polygon feature encapsulates about 2.5 million point features and executes in about 100 seconds.&amp;nbsp; Not bad I guess if we're running on ArcGIS desktop but this is part of a script that is a published Geoprocessing Service and I'm looking to optimize as much as possible to keep the GP service in a synchronous state rather than completing as an asynchronous job.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for any input!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;ply_fc = r'H:\MyFolder\gpdata.gdb\WM_InputPly_0624'
pnt_fc = r'H:\MyFolder\gpdata.gdb\WM_InputPts_0624'
arcpy.MakeFeatureLayer_management(pnt_fc, "PointFeatures")

#perform the selection 
arcpy.SelectLayerByLocation_management("PointFeatures", "INTERSECT", ply_fc)
rowcount = int(arcpy.GetCount_management("PointFeatures").getOutput(0))&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 08:19:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/optimizing-selectlayerbylocation-management/m-p/156796#M12079</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2021-12-11T08:19:03Z</dc:date>
    </item>
    <item>
      <title>Re: Optimizing SelectLayerByLocation_management?</title>
      <link>https://community.esri.com/t5/python-questions/optimizing-selectlayerbylocation-management/m-p/156797#M12080</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What type of geographic extent are we talking about, i.e., state, region, nation, or hemisphere?&amp;nbsp; What do the points represent?&amp;nbsp; Is there potentially a better way to model the data than using geometric/geographic points?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;All things considered, the times you state don't seem terrible, although they don't seem great either.&amp;nbsp; You mention the FGDB is stored on a network location.&amp;nbsp; Just for experimentation's sake, if you move the points to local disk(s), does it reduce the time?&amp;nbsp; If the points are in-memory, does it reduce the time?&amp;nbsp; It would be good to sort out how the different storage types (network disk, local disk, in-memory) affect the selection times.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Jun 2016 13:36:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/optimizing-selectlayerbylocation-management/m-p/156797#M12080</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2016-06-28T13:36:55Z</dc:date>
    </item>
    <item>
      <title>Re: Optimizing SelectLayerByLocation_management?</title>
      <link>https://community.esri.com/t5/python-questions/optimizing-selectlayerbylocation-management/m-p/156798#M12081</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Max extent (in Web Mercator Aux Sphere spatial ref): 40,000 acres&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My initial recommendation was to re-work the point feature class for those larger scales so as to reduce the density, and ultimately the processing times for the Selection.&amp;nbsp; But I hoped to fully vet this out before going down that road. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I look at the AGS logs, all seems to process ok 200 codes with this published GP service.&amp;nbsp; Looking at developer tools, it says about 225,000 milliseconds or about 3.75 mins to process that 40k acre polygon on points selection.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Jun 2016 13:58:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/optimizing-selectlayerbylocation-management/m-p/156798#M12081</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2016-06-28T13:58:41Z</dc:date>
    </item>
  </channel>
</rss>

