Friday, 6 March 2015

arcgis desktop - Output result of queries to dataset in Model Builder


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


etc...




Answer



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
id=arcpy.GetParameterAsText(0)
fieldName=arcpy.GetParameterAsText(1)
RowCount=arcpy.GetParameterAsText(2)
logFile=r'D:\scratch\GetCountTool_output.txt'
log = open (logFile, 'a')

log.write(id+"|"+fieldName+"|"+RowCount)
log.close

enter image description here


No comments:

Post a Comment