Monday, 22 April 2019

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

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...