Wednesday, 22 August 2018

arcgis desktop - Iterate through multiple Raster files and compute statistics using Zonal Statistics


I have a large number of raster images. What I'd like to do is to compute statistics on different sections of these raster files using a polygon. I think everyone is suggesting Zonal statistics. However, I'd like to iterate through all the raster datasets and then store their statistics in a single table. Zonal statistics does this for one raster and then overwrite it next time. I used the %Name% inline variable as for my table name, but that just creates lots of tables.


How can I iterate through all this raster datasets and create only one table?



Answer



If you want to do this entirely within ModelBuilder you would create a model that iterates over your rasters, feed into a zonal stats tool and the output of that feed into a collects tool exposed as a parameter as shown below.


Sub model


This becomes a sub-model in a model that takes the collected tables and appends them into a single table as show below.


Master model


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