I've seen a lot of questions asked and answered about trouble with the Select Layer By Location tool. Most ask about invalid input errors and the answer generally is to make sure to use layers (as apposed to feature classes). My problem is that I keep getting an error that some value is not Boolean, which I find strange since none of the inputs require boolean values.
I have two input files. Input1 is a shapefile of building footprints. Input2 is a shapefile of various shaped polygons. What I want to do is iterate through the polygons in Input2 and use each polygon to select the building footprint polygons in Input1 to do some work on them. I can't get past the Select By Location tool error to complete the work. Here is my code example:
with arcpy.da.SearchCursor("Input2","ID") as cursor:
for row in cursor:
value = str(row)
field = "ID"
exp = field + "=" + value
...do work on selected building polygons
I have the two inputs active in my arcpy map so they should be interpreted as layers. This is proven true since the Select Layer By Attribute tool works. I put the code into the python window, run it, and get this error message:
...in SelectLayerByLocation Execute Error: Failed to execute. Parameters are not valid. ERROR 000840: The value is not Boolean. Failed to execute (SelectLayerByLocation).
I gave the beginning of the script for context, but I've tried running the Select Layer By Location tool by itself in the python window and still get that message. When I use the Select Layer By Location tool from the tool box, I have no problem and it works. I've tried right clicking on the result, Copying As Python Snippet, pasting into the python window, and running, but I get the boolean error. I've tried using the Make Feature Layer tool in the python script (even though I shouldn't have to) with the same result. I've tried restarting.