Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am running a number of spatial queries on a dataset in model builder and want the number of selected features to be saved in a table. I don't want the features themselves but just the number of features that the query found. Is this possible?

enter image description here

I want

ID| Site | Number

1 | Brisbane | 9789

2 | Towoomba | 8389


share|improve this question
Perhaps a summary statistics with count of OID/FID. The options in model builder are somewhat limited. There is a get count tool but that's used for branching and the output of such I don't think can be logged. – Michael Miles-Stimson May 26 '14 at 5:04
Thanks, just thinking about it further, I will look at using… and maybe outputting to a collect values tool. – GeorgeC May 26 '14 at 7:01
Summary Statistics as suggested by @MichaelMiles-Stimson is how I would do this. – PolyGeo May 26 '14 at 7:59

Using the summary statistics tool will only get you half way there, it will give you one table per selection with the count of unique FID/OID. Geoprocessing tools honor selection layers and will only sum the selected features.

To compile the tables into a single table it is necessary to, for each sum table, add a Site field and calculate the name. Then the tables can be merged and exported to text format in the model. This will not do pipe delimited, to achieve this it is necessary to open the csv file and find & replace "," with "|".

As stated in the comment, there is a Get Count tool for modelbuilder but this is for condition branching and I don't know a way to get the output of this into a file using just modelbuilder. In python it wouldn't be a problem, the count could be written to a text file in pipe delim format using file operations!

share|improve this answer
up vote 0 down vote accepted

Thanks Everyone...

In the end it was quicker just to write a small script to get this with the Get Count Tool.

The script is

import arcpy
log = open (logFile, 'a')

enter image description here

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.