In a nutshell, the summary statistics table generated by my combination of the Feature Selection Iterator and the Select Layer by Location should have as many rows as there are features (in my case 25). Unfortunately, my resulting table only has one row. Please help me diagnose where I have gone wrong! I am using the ModelBuilder in ArcMap 10.1. The image below sets the stage:
I have a feature layer of 25 buffers, which are the light blue circles you see. Let’s call each buffer a community. Many buffers overlap. Each buffer has a unique ID.
I also have a feature layer of points (centroids). Some of the centroids fall within certain buffers, some fall outside. Every centroid has columns of information associated with it, two of which are important to me: Origins and Destinations.
WHAT I WOULD LIKE TO DO:
(1) I want to iterate through each feature in the buffer layer (loop through the buffers one-by-one) and ask: which centroids are completely within this buffer? (2) Then, I want to ask: of the centroids that fall within the buffer, what is the sum of the origins and the sum of the destinations? (3) Last, I want to combine the results of (1) and (2) in a table with three columns of information: The buffer ID, the sum of origins in that buffer, and the sum of destinations in that buffer.
MY SETUP and MY PROBLEM
- I am using the Feature Selection Iterator in ModelBuilder to loop through the buffer file. I have chosen to group by the BufferID field.
- I use the Select Layer by Location tool to select the centroids that are ‘completely within’ each iterated feature in the buffer file. (The buffer is the selecting feature, the centroids are the input feature layer)
- The output of this geoprocess, labeled Centroids(2) in the image below, is, I believe, the collection of centroids ‘completely within’ a particular buffer.
- I use the Summary Statistics tool to calculate the sum of the Origins and Destinations associated with Centroids(2). In the Summary Statistics tool interface, I select Origins and Destinations as statistics fields and I calculate their sum. The output of this tool is a table. I select the location of this output table.
- This is where I am stuck. If I run the model above, I get this:
- This is interesting, because I see the tools turning to red as many times as there are buffers – so I believe that the model is iterating through each feature in the buffer layer, selecting centroids by location, and creating summary statistics.
- Clearly, though, I have not set up the model properly to get the desired output because the resulting table has only one row. There should be as many rows as there are buffers, which in this case is 25. Moreover, I would like the OBJECTID* in the above image to be the BufferID from the buffer layer. When I grouped the Feature Selection Iterator by BufferID I thought this might carry over to the Summary Statistics; it did not.
- Although the model is iterating 25 times (as evidenced by the tools turning red 25 times when I run the model) the output it generates is for one iteration only. What do I have to change in order to get: (A) a table with 25 rows, and (B) an ID that corresponds to the BufferID?
My sincere thanks for your help and suggestions.