Mean value from raster to polygons

2807
6
05-16-2013 07:39 AM
KimJensen
New Contributor
I have raster data of a forest age in an area. The area is divided into polygons because of its diverse nature. I would like to obtain a generalized mean forest age in each polygon. How can I most easily carry out such an operation. What I find is to convert raster to shap files and then do a spatial join ... But there must be a better approach?

Some parts of the polygons, in many cases, large portions, consisting of no data on the matter.

Grateful for answers.
0 Kudos
6 Replies
ChristopherBlinn1
Occasional Contributor III
Hello Kim,

I believe the most efficient way to do this would be to convert the raster to points and perform a spatial join between the points and the polygon shapefile.

To address for your 'no data' values in your raster, after converting the raster to points, you can start an edit session, perform a selection by attribute to select all 'null' valued points then delete your selection.

Saving your edits and then performing your spatial join will then only use points with values to calculate your statistics (which in this case, you would select MEAN).

Hope this helps!

Best,
Chris B.
0 Kudos
KimJensen
New Contributor
Hello Kim,

I believe the most efficient way to do this would be to convert the raster to points and perform a spatial join between the points and the polygon shapefile.

To address for your 'no data' values in your raster, after converting the raster to points, you can start an edit session, perform a selection by attribute to select all 'null' valued points then delete your selection.

Saving your edits and then performing your spatial join will then only use points with values to calculate your statistics (which in this case, you would select MEAN).

Hope this helps!

Best,
Chris B.

Okay that's what I thought. It is not appropriate to interpolate the raster values �??�??within polygons then, somehow? Or use some density analysis? Or block statistics?
0 Kudos
ChristopherBlinn1
Occasional Contributor III
Okay that's what I thought. It is not appropriate to interpolate the raster values �??�??within polygons then, somehow? Or use some density analysis? Or block statistics?


Interpolation will estimate values between known values.

Density will only account for the number of values within a given area.

Block statistics will not use your polygons (unless you create a kernel file for an irregular neighborhood which would take a great deal of time) to calculate your statistic.

Although it may sound cumbersome, the process I outlined earlier is pretty straightforward and only requires three steps:

1. Convert raster to points
2. Select/delete null values
3. Spatial join points to polygons
0 Kudos
KimJensen
New Contributor
Interpolation will estimate values between known values.

Density will only account for the number of values within a given area.

Block statistics will not use your polygons (unless you create a kernel file for an irregular neighborhood which would take a great deal of time) to calculate your statistic.

Although it may sound cumbersome, the process I outlined earlier is pretty straightforward and only requires three steps:

1. Convert raster to points
2. Select/delete null values
3. Spatial join points to polygons


Okay, but can I get mean then? It might on the other hand not be very hard to calculate this with the field calculator for each polygon?

What I mean with null values �??�??is that not all of the polygon covered by the grid. I might not have to deal with these at all then because they represent water surfaces, built up areas, etc..
0 Kudos
EricRice
Esri Regular Contributor
Why not just use Zonal Statistics as Table with the stat set to MEAN?  The tool has an option to ignore NoData in the calculation.  It's on by default.

Your use-case is the reason this tool exists.  You don't have to do a workflow to get an answer.  This is the 'better approach' you speak of.

Best,
Eric
0 Kudos
ChristopherBlinn1
Occasional Contributor III
Okay, but can I get mean then? It might on the other hand not be very hard to calculate this with the field calculator for each polygon?

What I mean with null values �??�??is that not all of the polygon covered by the grid. I might not have to deal with these at all then because they represent water surfaces, built up areas, etc..


Yes, you can get the mean.

After creating your layers and removing null values, right click on the polygon feature class, go to Join and Relates, select Join.  There is a drop-down menu at the top of the dialogue box, select Join data from another layer based on spatial location.  Select the point feature class created from the raster, select Average for your summary.
0 Kudos