How to iterate through attribute table, perform geoprocess, then add data to new table

11-25-2020 04:38 PM
Labels (1)
New Contributor

I want to iterate through a process and compile a table of new data.  Specifically, I want to clip roads to a neighborhood polygon in a city shapefile, calculate the length of the roads in the new clipped shapefile, and output it to a table.  I can do this once and I can do it through all of the rows of the to get a total (of all roads in the city) on one line in a table, but I do not know how to iterate through multiple neighborhoods (polygons in a shapefile) and create multiple lines of data in a table (ie the total length of roads in each neighborhood polygon).

To be clear, I want to:

1. clip roads to neighborhood

2. summarize statistics -- SUM

3. add sum to table

4. iterate to next line in feature class

0 Kudos
2 Replies
MVP Frequent Contributor

Have you looked into model builder for this?


0 Kudos
Occasional Contributor III

I'm trying to create a similar model. I would like to iterate through a table of address points, select all addresses that fall within x distance of that address point, sum the number of dwellings (this is different than the total number of address points as some may be a duplex, triplex etc.) and write this back to the address point that is currently selected in my iteration. My model fails on the calculate tool. I'm not sure if my arcade expression is incorrect or if it's even possible to write to the selected address. My understanding is that the selected address is a view of the layer and not the layer itself..? (the tool help page states: Selected Rows is a table view that can be used in other geoprocessing tools that accept a table view in ModelBuilder)

Here's my arcade expression (the error I receive is invalid expression Table not found ParcelinBuffer which definitely exists in my test.gdb):

var ParcelinBuffer = FeatureSetByName($datastore,"ParcelinBuffer",["NumRU_RDU_FRU"], True);
Return SUM(ParcelinBuffer.NumRU_RDU_FRU);


0 Kudos