Select all polygon with 40 meters of a selected polygon and then get an average value of one of the attributes from the selected polygons.
I need to do this for each of the buildings within a city.
I am thinking I need a for each statement but I am not sure.
Any help is greatly appreciated.
maybe, but a Spatial Join might get your there if you specify an appropriate
join_operation, join_type, field_mapping, match_option, and search_radius,
Spatial Join—Help | ArcGIS Desktop
Your code might help, but `for loops` can often be replaced by things like list comprehensions
GenerateNearTable tool would be faster than a SelectByLocation in a for loop.
... then probably just SummaryStatistics based on the BUILDING_ID as the case field (mean value of the other featureclass)
No programming required!
So Summarize Within—Help | ArcGIS Desktop was the tool I thought would work but I guess it does not find the sum of the polygons that touch the buffer. I get some average number for the percent that is within my buffer. I am not sure why this is happening.