[GRASSLIST:4467] Re: Rastervalueoutput for cover vectorfiles

Gordon Keith gordon.keith at csiro.au
Wed Sep 11 22:31:44 EDT 2002


On Thu, 12 Sep 2002 12:02, Gordon Keith wrote:
> On Thu, 12 Sep 2002 11:38, Martin Wegmann wrote:
> > hello,
> >
> > I have a bit more than 100 polygons for which I want to extract the
> > mean values of a rastermap behind it. The output should be: vector
> > 1 = mean rastervalue xy, vector 2 =  ... and so on.
> > I started to do it with r.what and a calculator but I hope there is
> > a easier way to do it.
>
> What I do is:
>
>     v.to.rast in=train_r out=train
>
>     r.statistics base=train cover=raster method=average out=raster_avg
>     r.stats -l raster_avg >> avg.txt

What I forgot is that r.statistics only works on integer maps. What I 
actually do is muliple my rast by 1000000 and manually (gawk script) 
divide the result by 1000000.

r.mapcalc "raster = int(raster0 * 1000000)"

Regards
Gordon
-- 

Gordon Keith
Programmer/Data Analyst
Marine Acoustics
CSIRO Marine Research
http://www.marine.csiro.au

"I think there is a world market for maybe five computers"
- Thomas Watson, Chairman of IBM, 1943



More information about the grass-user mailing list