By FlyingMGET

2013-11-29 14:30:03 8 Comments

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?


@Hen Goodchild 2017-03-11 11:31:18

I know this is an old post, but I came across it recently looking for similar answers. I failed at implementing these methods, but I found a different way of approaching it with ModelBuilder that was successful in appending fields named the same as the rasters. Basically by iterating the rasters to add fields, then joining and copying across the relevant data. My model is below:

enter image description here

This still creates a long list of tables, but if they are stored in a 'disposable' geodatabase they can be deleted at the end as all the values are attached to the point file's attribute table.

enter image description here

@FlyingMGET 2013-12-02 21:34:04

My previous answer had some issues as @Hornbydd mentioned! So here is the one that worked. I could even ran it without having the "Collect tools" inside the model and just used the "Append" tool. enter image description here

@dtanon 2016-12-02 14:04:22

Are you able to keep the origonal file names in this set up?

@Hornbydd 2013-11-30 00:58:42

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

@FlyingMGET 2013-11-30 17:12:44

Thanks @Hornbydd. I implemented your idea and actually combined the two models, and I got it to work fine. One should keep in mind that the receiving table must have the exact same attribute and column names as the iterative tables so each new table can be appended.

@FlyingMGET 2013-12-01 06:48:14

Is there a way to retrieve input raster file names and save them in the final table? This is a big help since I cant exactly say which value in the table goes to which raster.

@Hornbydd 2013-12-02 10:05:05

Yeah, before you send your table to the collects tool put in an add field then calculate tool where the expression would be %Name%.

@dtanon 2016-12-05 15:13:32

I tried to add field and calculate to add a field of the original file names, but I have problems making it work. Can you maybe post a screen shot of that part?

Related Questions

Sponsored Content

2 Answered Questions

[SOLVED] Running zonal statistics on multiple raster tiles using QGIS?

1 Answered Questions

[SOLVED] Compute zonal statistics for portion of polygons

1 Answered Questions

[SOLVED] Tabulate Area Using Multiple Shapefiles and Multiple Rasters

1 Answered Questions

Sponsored Content