Select to view content in your preferred language

How can I extract all cells from a fishnet into their own cells?

3643
5
02-23-2012 12:49 PM
TaylerHamilton
Emerging Contributor
I want to run the band collection statistics tool between 2 different rasters to determine their correlation. I can run this on the entire region and get 1 value, but I would like to create several smaller areas within the region to get several r values for the entire region.

So far I have created a fishnet over the region, with cells that are 1000m x 1000m. I want to determine what the correlation between 2 rasters is within each cell of my fishnet, thus resulting in several r values over the entire region.

I don't know how to run the band collection statistics tool within each of cell of my fishnet layer, so I thought I would extract each cell as a new layer...my only problem is that I have ~4000 cells, so this would be very time consuming.

I have tried to create a model in model builder to select each cell and then extract the selection. I used the "iterate feature selection" iterator to select each different cell, but then I don't know what tool I should use to extract/export each cell selection as a new layer. I know how to export selected data (by right clicking on the layer I want to export from), but I don't know how to get this tool into my model.

I ultimately would like to run band collection statistics on each cell (between 2 rasters) and apply the r value to the cell, allowing me to display areas of high and low correlation with a stretched colour scheme.

If anyone has any ideas on how I can run this a little more efficiently, please let me know.
0 Kudos
5 Replies
TaylerHamilton
Emerging Contributor
I guess a better question is:

Can I program band collection statistics to run within the area of one selected fishnet cell? And do that for all of the cells?

I am not a programmer...so this is totally out of my realm...that's why I don't know if it is possible at all.
0 Kudos
DarrenWiens2
MVP Honored Contributor
I used the "iterate feature selection" iterator to select each different cell, but then I don't know what tool I should use to extract/export each cell selection as a new layer.

From the Iterate Feature Selection help page: "The output Selected Features is a feature layer and can be used in other geoprocessing tools that accept a feature layer in ModelBuilder."

This is all totally untested, but it sounds like you should be able to hook up the Selected Features bubble to Extract By Mask (to get only those raster cells), then to Band Collection Statistics, then append the resulting table to a master table (or else you'll have 4000 tables).
0 Kudos
TaylerHamilton
Emerging Contributor
Thanks, Darren. I just built the model and it looks like it is going to work. I will let it run and let you know the results when I get them!
0 Kudos
TaylerHamilton
Emerging Contributor
So it does work! My next question is, how can I get the final output to be different for each iteration automatically? I know how to set the output as a parameter, but it would be too time consuming for me to enter in the output name every single time it runs...and that would defeat the purpose of an iterator.
0 Kudos
TaylerHamilton
Emerging Contributor
I found a better answer...batch processing! What a life saver.

No need for iterations or extract by mask. Extract by mask seems to work sporadically (as I found by trying to use it, and then also seeing several other people have the same problem in the forums).

So this is what I did:

To extract all cells from my fishnet, I used the select layer by attribute tool. Arc10 freezes all the the time...so I did it manually. I should have been able to make model and set the expression and output layer as parameters, then run in batch processing...but arc10 seems extremely crash happy when I try to use a model or batch processing.
0 Kudos