graeme

ArcPy & SelectLayerByLocation Performance

Discussion created by graeme on Jul 21, 2011
Latest reply on Apr 5, 2013 by graeme
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.

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.

Is there a quicker way to do this using ArcGIS Desktop 10 and ArcPy?

PS I've made related posts to this on Stack Exchange and ArcGIS Ideas with no quick solutions so am beginning to think that I'm not actually missing anything.

Outcomes