Zonal Statistics as Table on Model Builder!!!

5274
25
Jump to solution
07-23-2013 11:13 AM
ShikoNjuno
Occasional Contributor
So I have a model that utilizes the Zonal Statistics as a Table tool and it runs beautifully. However, the output is incredibly false.

The input feature zone data is a shapefile comprised of a select few polygons.
The zone field selected is FID.
The input value raster is a .tiff file which stores the correct values for the output.
The output table is saved to the workspace chosen by user.
And the statistic performed is the MEAN. Which means the output for every FID row is an average of all pixel values in the raster file within that polygon shape.

What's happening when the model runs is that the output is just incorrect....almost like there is no zonal recognition happening.
Is anyone familiar with this and perhaps what I can do to make the output correct??
Thanks
0 Kudos
25 Replies
ShikoNjuno
Occasional Contributor
I realize the image is unclear.....let me try again.
0 Kudos
ShikoNjuno
Occasional Contributor
Here it is.....let me know if you have any questions.
I'll be working on the TIFF to GRID conversion.

[ATTACH=CONFIG]26160[/ATTACH]
0 Kudos
ShitijMehta
Esri Regular Contributor
Did you check if the spatial references for raster and shapefile match?
0 Kudos
ShikoNjuno
Occasional Contributor
Did you check if the spatial references for raster and shapefile match?


How do I check that. I know I checked to make sure the Projection is the same for both, but how exactly do I check spatial reference?
0 Kudos
ShikoNjuno
Occasional Contributor
Export it as GRID (from drop down window to select).


Hey thanks Tom,
This seems to have made quite a difference. Better!!
However, the values are still not quite right.
Do you know for raster analysis if using the Double or Float Type is more advantageous than the other??
Maybe it is a Spatial Referencing issue as Shitij mentioned?!!
0 Kudos
TOMKONG
Occasional Contributor II
Hey thanks Tom,
This seems to have made quite a difference. Better!!
However, the values are still not quite right.
Do you know for raster analysis if using the Double or Float Type is more advantageous than the other??
Maybe it is a Spatial Referencing issue as Shitij mentioned?!!


For raster data analyze, the data type in integer will make calculation process quickly(some ESRI analyze tool can only handle integer raster).In your case, there is no difference between two data type.

Spatial reference includes datum, projection, tolerence (or cell size for raster).
You may test if cell size will affect your result by using different cell size.
0 Kudos
ShikoNjuno
Occasional Contributor
Thanks for the clarification Tom. I actually just realized that all that information is in the Properties menu of each file :rolleyes:
And I have confirmed that they all have matching Spatial Reference.
As for the Cell Size....I'm already pretty tight at 60 by 60, but I'll go ahead and try going lower.
Also, do you know if the Cell Assignment is better as CENTER or MAX??
0 Kudos
TOMKONG
Occasional Contributor II
Thanks for the clarification Tom. I actually just realized that all that information is in the Properties menu of each file :rolleyes:
And I have confirmed that they all have matching Spatial Reference.
As for the Cell Size....I'm already pretty tight at 60 by 60, but I'll go ahead and try going lower.
Also, do you know if the Cell Assignment is better as CENTER or MAX??


The cell size 60  * 60--it is 3600 sq. I don't know your purpose, but it is so big.
You may set it as 1*1, then the return may fit your expectation.
The Cell Assignment method doesn't affect your  result but cell size.
If the cell size is too small, the tool doesn't work sometimes. You need to try.
0 Kudos
AliciaMein
New Contributor III
The cell size 60  * 60--it is 3600 sq. I don't know your purpose, but it is so big.
You may set it as 1*1, then the return may fit your expectation.
The Cell Assignment method doesn't affect your  result but cell size.
If the cell size is too small, the tool doesn't work sometimes. You need to try.


Usually sampling to a smaller cell size is inappropriate because you will make assumptions from data that is not meant to be used at these scales.  I would not resample the raster unless you want your results to be tainted.
How large are the polygons?  Realize that the app will first convert your polys to rasters.  So as I first said, please set up your environment setting inside the zonal stats tool.  The enivronmental settings button is at the bottom of the tool.
Set your snap raster to the raster.  The extent to your polys and the cell size to the raster, and see what happens.
Realize that the center of a raster cell has to fall inside the poly before it will be included in the stats.
Hope that helps.
0 Kudos
ShikoNjuno
Occasional Contributor
Usually sampling to a smaller cell size is inappropriate because you will make assumptions from data that is not meant to be used at these scales.  I would not resample the raster unless you want your results to be tainted.
How large are the polygons?  Realize that the app will first convert your polys to rasters.  So as I first said, please set up your environment setting inside the zonal stats tool.  The enivronmental settings button is at the bottom of the tool.
Set your snap raster to the raster.  The extent to your polys and the cell size to the raster, and see what happens.
Realize that the center of a raster cell has to fall inside the poly before it will be included in the stats.
Hope that helps.


Thanks for you input Alicia,my polygons are all different sizes but the thing about that file is this.... It was originally a raster TIF which I converted to a shapefile of polygons. This created really rough edges around the polygon and it still doesn't look quite right. The reason I had to do this is because I needed to create another raster TIF of one of the attribute fields.Then, as per Tom's earlier suggestion, I converted it to a raster GRID as spatial analyst tools are said to work better with GRID types(which I did find to be true). So far the values for this particular element (landuse) is the most inaccurate of any of my other data. I wonder if it has something to do with all the conversions I've had to make?!?

Anyway I changed the settings as you suggested and below is a snapshot of what my current settings are. Please take a look and let me know if I should make any changes:

[ATTACH=CONFIG]26176[/ATTACH]


And if you can think of anything else I might try let me know too.
Cheers.
0 Kudos