I am running an arcpy script in command prompt with ArcGIS Pro installed. For some reason the Select By location tool produce different result every time I run it.
Here is the selection code:
arcpy.SelectLayerByLocation_management('lowland_layer', 'INTERSECT', 'buildings_layer', selection_type='NEW_SELECTION')
arcpy.CopyFeatures_management('lowland_layer', 'lowlands_with_buildings.shp')
I have no idea why this would produce different results everytime I run it. I have already made sure that all files has the same coordinate system, as well as the outputs.
In your first code block, where is this_selecting_feature
being defined?
Also, where are you copying into memory? Neither of the code blocks show any references to any in-memory workspace.
Actually this part of the code doesn't use any in_memory. `this_feature` was created, but `this_selecting_feature` is an existing file on the machine and its' the first time it's used in the code. Basically it's something like: this_selecting_feature = "path/to/file.shp"
I mentioned `in_memory` above to explain the content of my code. Just in case that might be the issue. But it seems like it's not that.
My conclusion from this is that you can't use a variable/file modified with UpdateCursor as a layer for selection.