AnsweredAssumed Answered

Optimizing SelectLayerByLocation_management?

Question asked by jamesfreddyc on Jun 27, 2016
Latest reply on Jun 28, 2016 by jamesfreddyc

I'm looking for any alternatives to enhancing an existing SelectByLocation process.  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.

 

1 polygon in the selection feature class (an in_memory FC).

>10million points in a target point feature layer (a FC in a FGDB on a network location registered with ArcGIS Server)

 

The extent of the polygon feature encapsulates about 2.5 million point features and executes in about 100 seconds.  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.

 

Thanks for any input!

 

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))

Outcomes