I'm using ArcGIS 10.2 for Desktop and would like to calculate the population within a specific distance from bus stops.
My input layers are:
- census block (polygon) with population
- undissolved bus buffers that overlap each other (polygon, in 1 layer)
I calculated population density and converted my block data into raster, then used Zonal Statistics as Table tool to calculate the sum of population in each buffer. If I use this tool directly, it will ignore 2/3 of my buffers because they overlap with others. Therefore I need code to iterate this through each buffer (about 600 in total).
My situation is the same to the one in this topic Intersecting Overlapping Polygons Individually in ArcGIS
I used the code by @phloem but it returns a table with only one row (which is one of the buffers I have). Could someone look through and give me some advice? I'm new to Python.
store_buffs = r"H:\DMLA\NTAS\Map\Shapefiles\2013_A30min_weekday.shp" density_ras = r"D:\Downloads\block_clipped_Raster1.tif" table_list =  with arcpy.da.SearchCursor(store_buffs, ["FacilityID"]) as cursor: for row in cursor: exp = '"FacilityID" = ' + str(row) temp_table10 = r"in_memory\temp_table10" + str(row) temp_shp10 = r'in_memory\temp_shp10' arcpy.Select_analysis(store_buffs, temp_shp10, exp) arcpy.sa.ZonalStatisticsAsTable(temp_shp10, 'FacilityID', density_ras, temp_table10, 'DATA', 'SUM') table_list.append(temp_table10) del row final_table = r"D:\Downloads\2013_A30min_weekday.dbf" arcpy.Merge_management(table_list, final_table)
I cannot post comment on phloem's answer because I don't have enough reputation. That's why I have to create another topic.
I found an ESRI supplemental tool called Zonal Statistics As Table 2, which allows me to calculate overlapping polygons. However, this tool takes forever to run (6 hours for me). I would like to have a more efficient way to process data.