[GRASS-user] Calculate statistics for raster values in polygons

If you don't want all the nine statistics that v.rast.stats gives you
(can be unnecessary and a bit slow for large rasters), you can use
r.statistics instead, with method=average.

Luis Lisboa wrote:

   Hi all
   I'm reading the v.rast.stats Help and I'm a bit confused. It says "Calculates basic univariate statistics from a raster map only for the parts covered by the specified vector map". But for >>instance if all my region is covered by different polygons and, if I want to calculate for each polygon my average value from raster, is this function helpful? (e.g. I have vector with

yes, exactly the function you need. It adds nine attribute columns to your vector layer with min,max,mean, etc values calculated from the raster.

A. Marcia BARBOSA wrote:

If you don't want all the nine statistics that v.rast.stats gives you
(can be unnecessary and a bit slow for large rasters), you can use
r.statistics instead, with method=average.

Yes. Although I think the original post was asking to get the raster values into an existing vector. IIUC r.statistics would require converting the vector to a raster, then back to a vector. Or am I missing something?

  

Luis Lisboa wrote:
      
   Hi all
   I'm reading the v.rast.stats Help and I'm a bit confused. It says "Calculates basic univariate statistics from a raster map only for the parts covered by the specified vector map". But for >>instance if all my region is covered by different polygons and, if I want to calculate for each polygon my average value from raster, is this function helpful? (e.g. I have vector with
      
yes, exactly the function you need. It adds nine attribute columns to your vector layer with min,max,mean, etc values calculated from the raster.
    

_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

This mail was received via Mail-SeCure System.

--
Micha Silver
Arava Development Co. +972-52-3665918
http://surfaces.co.il

A. Marcia BARBOSA wrote:

True. But actually it would be quite useful if v.rast.stats would give
us an option to select the statistics we wanted. Sometimes we really
just want the mean, or the mean and range, and if the raster is very
large the process can take a long time to give us unnecessay stats. Is
this possible?

Good idea. Perhaps bring the suggestion to the developers. (or contribute yourself...)
Regards,
Micha

Cheers,

Yes. Although I think the original post was asking to get the raster values
into an existing vector. IIUC r.statistics would require converting the
vector to a raster, then back to a vector. Or am I missing something?
    
--
Micha Silver
Arava Development Co. +972-52-3665918
http://surfaces.co.il

On Fri, Apr 23, 2010 at 12:34 PM, Micha Silver <micha@arava.co.il> wrote:

A. Marcia BARBOSA wrote:

True. But actually it would be quite useful if v.rast.stats would give
us an option to select the statistics we wanted. Sometimes we really
just want the mean, or the mean and range, and if the raster is very
large the process can take a long time to give us unnecessay stats.

Internally, it uses
r.univar -g map ...

so I don't think that there is anything to accelerate with a few changes.

...

Good idea. Perhaps bring the suggestion to the developers. (or contribute
yourself...)

It is "just" a script, please review it and feel free to improve it!

Markus