I have a shp file with some rectangles and I want to extract statistics within these areas from a raster image. I prefer ArcMap 9.3.
4 Answers
Your task could be done easily by using Zonal Statistics tool of Spatial Analyst extension.
-
+1. This assumes the rectangles do not overlap, though. If they do overlap, you need to loop over the rectangles (or over subsets of disjoint rectangles).– whuberCommented Jan 20, 2011 at 16:58
-
2For versions of ArcGIS prior to 10, Hawth's tools has Zonal Statistics ++ which deals with overlapping polygons, give it a shot. spatialecology.com/htools/zonalstats.php– user681Commented Jan 20, 2011 at 19:49
As a free alternative, SAGA GIS contains a module that may do what you want (Grid Statistics for Polygons). http://www.saga-gis.org/saga_modules_doc/shapes_grid/index.html
-
1+1. "Grid statistics for polygons" appears only to obtain a limited set of quantiles (5%, 10%, ..., 95%). However, the ability to obtain any quantile (apart from the median) does not exist in ArcGIS, so it's good to know about this capability.– whuberCommented Jan 20, 2011 at 17:01
You can also use GRASS for zonal statistics. From doc page:
r.statistics is a tool to analyse exploratory statistics of a "cover layer" according to how it intersects with objects in a "base layer". A variety of standard statistical measures are possible (called "zonal statistics" in some GIS).
The available methods are the following:
- distribution
- average
- mode
- median
- average deviation
- standard deviation
- variance
- skewness
- kurtosis
- minimum
- maximum
- sum