I would like the following to select (highlight) the "project" layer that intersects the grid, and then pull a record from the selected "Grid". I do not need to save the layer.
Note: Running the script from within ArcMap in the Python Console window.
import arcpy
# Make a layer from the feature class
arcpy.MakeFeatureLayer_management("project","project_lyr")
# Then add a selection to the layer based on location to features in another feature class
arcpy.SelectLayerByLocation_management("project_lyr","INTERSECT","Grid")
This code runs and no errors are given, yet it does not select(highlight) any features. Any Idea why? Also runs really slow.
Basically I'm trying to do this:
This runs really fast almost instant, but I want to do the same using python. I just need a value from the selected feature's table, I don't need a copy of the layer.
Part of the solution may be to use the in-memory workspace which is
Writing data to the in-memory workspace is often significantly faster than writing to other formats...
Just not sure how to implement in-memory workspace
import arcpy
command takes awhile to run.arcpy.MakeFeatureLayer()
line, sinceproject
is already a layer. Just doarcpy.SelectLayerByLocation_management("project","INTERSECT","Grid")
.