Hi,
I would like to create stand alone script for do the select by location using two features.
How can I do that?
Using the documentation the error below show:
ExecuteError: Failed to execute. Parameters are not valid.
ERROR 000368: Invalid input data.
Failed to execute (SelectLayerByLocation).
Thank´s
Solved! Go to Solution.
Select by location operates on feature layers (i.e. objects in an ArcGIS Pro session table of contents). Not on feature classes, which is what you're currently feeding into your script.
If you add a "Make Feature Layer" operation uysing your inputs, then use the outputs of that for your select by location then you should get there.
Select Layer By Location (Data Management)—ArcGIS Pro | Documentation
which code sample are you following and what is your script code?
Follow below my code:
import arcpy
entrada = r"D:\\Profile\\OneDrive - Imagem Geosistemas e Comercio LTDA\\Documentos\\ArcGIS\\Projects\\MyProject10\\MyProject10.gdb\\teste"
recorte = r"D:\\Profile\\OneDrive - Imagem Geosistemas e Comercio LTDA\\Documentos\\ArcGIS\\Projects\\MyProject10\\MyProject10.gdb\\teste1"
saida = r"D:\\Profile\\OneDrive - Imagem Geosistemas e Comercio LTDA\\Documentos\\ArcGIS\\Projects\\MyProject10\\MyProject10.gdb\\teste_saida"
fst = arcpy.SelectLayerByLocation_management(entrada,'intersect', recorte)
arcpy.conversion.ExportFeatures(fst,saida)
No work unfortunately.
Thank´s
Move your data to a local folder on your computer. One Drive isn't supported
Yes, I understand! I was changed to local folder already, but no work. The same error shows.
Select by location operates on feature layers (i.e. objects in an ArcGIS Pro session table of contents). Not on feature classes, which is what you're currently feeding into your script.
If you add a "Make Feature Layer" operation uysing your inputs, then use the outputs of that for your select by location then you should get there.
Hi!
Solved my problem. Thanks.
Awesome. Can you mark it as an accepted solution then pls 🙂