[GIS] Iterate zonal statistics table model builder – add field and name each row by raster

arcgis-desktopmodelbuilder

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

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

Related Question