Thursday, 2 May 2019

arcgis desktop - Iterate zonal statistics table model builder - add field and name each row by raster


I have a model builder model to run zonal statistics as a table on multiple rasters and merge the output table into one table



However, I would like to add a field to the merged output table that identifies each each record by it's raster name.


Since I'm new to figuring this out, can someone tell me what steps I need to add in order to make that happen?


See image attached.


Thanks,


enter image description here



Answer



First thing is to get the structure of your model correct:


You need to put your Iterator>Zonal Stats>Collects tools in a sub-model and expose the collects tool as a parameter. Then that model is a sub-model that feed into the Merge tool. Have a look at this thread


Then insert the add field>calculate Field tools after your zonal stats tool and the output of the calculate field feeds into the collects tool. Finally use inline substitution as the expression in the field calculate tool. If you don't know what that is then read the help file as there are numerous examples.


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...