I am trying to create a script with Arcpy that buffers a feature layer point of Salt Lake City.I have been having trouble getting my select by location function to run. I don't know if it's from my distance parameter value in my select by location which is to see all other cities 200 miles within Salt Lake, but I keep getting Error output like such. I tried altering the variables but was having no luck.
import arcpy arcpy.env.workspace = (r"C:\Arcpy\MapAutomation.gdb") Places = r"C:\GIS_Data_Files\shp\ne_10m_populated_places.shp"
The above code is the are variables for input shapefiles and local workspace.
PlacesQuery = "name = 'Salt Lake City'" arcpy.MakeFeatureLayer_management(Places,"SaltLake",PlacesQuery) SLPlaces200mi = arcpy.SelectLayerByLocation_management(Places,"WITHIN_A_DISTANCE" "SaltLake","200 MILES","NEW_SELECTION")
The above code Creates a feature layer from the places shapefile and inputs a variable for a definition query to return Salt Lake City. Then the select by location looks at the places layer and sees if there are other values that are 200 miles away from Salt Lake. This is where I run into my error:
arcgisscripting.ExecuteError: ERROR 000622: Failed to execute (Select Layer By Location). Parameters are not valid.
ERROR 000628: Cannot set input into parameter search_distance.