I am trying to make a script that will go through buildings in a shapefile row-by-row and do a count of points within .25, .5,...1 mile of it. The other points are restaurants.
import arcpy arcpy.env.workspace = "C:\Users\zafard\Desktop\Building.gpd" #need to do 4 iterations for the distance radii buffDist = [0.25,0.5,0.75,1] for Dist in buffDist: print ("FOR A %s MILE RADIUS: " % (Dist)) inTable = "C:\Users\zafard\Desktop\Building\XYBuild.shp" #set up cursor in table rows = arcpy.SearchCursor(inTable) row = rows.next() #set up loop to analyze every row of the table While row: print row.OBJECTID #use select by distance tool arcpy.SelectLayerByLocation_management("FRest","WITHIN_A_DISTANCE", row, Dist, "NEW_SELECTION") #count the hopefully selected points for the layer. count = int(arcpy.GetCount_management("FRest")) print count row = rows.next()
I am now getting an error with running the tool in the while loop. "Object: Error in executing tool" Please help! This is mindwrakking!