Is there a way to print out how many features are selected under a buffer for analysis purposes using Python? I have the following script where I put an 805-meter buffer around grocery stores, and brought in a shapefile called schools and wanted to know how many schools fall within 805 meters (which is 0.5 miles) of a grocery store? When I run the script it shows me the selection of schools, but I was wondering if there was a way I can make the program print or create table full of values on how many features are selected under the buffering circle. Please let me know. Thank you!
#Creating features list for Buffer Analysis
fcList = ["schools.shp", "BroomeGroceryStores.shp"]
print(fcList)
#Selecting schools that fall within 805 meters of a grocery store
buffList = []
for fc in fcList:
buff = arcpy.Buffer_analysis("BroomeGroceryStoress.shp", "Results/BroomeGroceryStores_buffer.shp", "805 METERS")
buffList.append(buff)
print arcpy.GetMessages()
for buff in buffList:
arcpy.SelectLayerByLocation_management("schools", "WITHIN", buff, 0, "ADD_TO_SELECTION")
print "Done"
GetCount
Get Count—Data Management toolbox | Documentation
as suggested in
Select Layer By Location—Data Management toolbox | Documentation
then a little
AddMessage—ArcPy Functions | Documentation
they have an example there