[gdal-dev] image operation over areas defined by a shapefile

Matt Perry perrygeo at gmail.com
Mon Dec 12 01:48:47 EST 2011


Hi Xiaodong,

On Sun, Dec 11, 2011 at 2:22 PM, Xiaodong Zhang <xiaodong.zhang2 at und.edu> wrote:
> I'm wondering if someone has done something like this and would like to
> share the experience. Say, I have an image, e.g. NDVI, and a shapefile
> define one or more areas (polygons) with the image. How to calculate the
> statistics for each area, for example, the mean value of NDVI within each
> polygon.

You'll see this operation referred to as "zonal statistics". GDAL has
no utilities to do this directly but there are several open source
implementations that do:

- QGIS has a "Zonal Statistics" plugin
- GRASS has this capability in the r.statistics module
- R has a zonal() function
- starspan is a GDAL-based application specifically for zonal stats.

Any of the above might suite your needs depending on your desired
workflow and programming environment.

Good luck,
-- 
·´¯`·.¸. , . .·´¯`·.. ><((((º>`·.¸¸.·´¯`·.¸.·´¯`·...¸><((((º>
"The best way to predict the future is to invent it."  -- Alan Kay
Matthew T. Perry
http://www.perrygeo.net
http://viedevelo.wordpress.com


More information about the gdal-dev mailing list