[GRASS-user] faster than v.rast.stats

Hello,

I’m trying to retrieve some statistics from several rasters, based on overlaying vectors.

I’m using v.rast.stats but it is very slow. Is there another way?

I read something about Starspan, a software that does this same thing faster, but I can,t find it to download.

Can anybody help?

Frederico Mestre

There is an add-on v.rast.stats2 which is stated to be faster. I encountered and reported a bug a while ago on it, but I believe it was fixed.

Mark

On Jun 21, 2011 10:03 AM, “Frederico Mestre” <mestre.frederico@gmail.com> wrote:

Hello,

I’m trying to retrieve some statistics from several rasters, based on
overlaying vectors.

I’m using v.rast.stats but it is very slow. Is there another way?

I read something about Starspan, a software that does this same thing
faster, but I can,t find it to download.

Can anybody help?

Frederico Mestre

Frederico,

One possible way is to generate a raster MASK file from the vector data and, using the mask for each polygonal area and R, calculate statistics that way. Although, honestly, I don’t know if that would be faster or not.

Another possibility is something like this (snippit from a GRASS script in a Linux environment), that we have used where speed is critical:

···
-- 
Thomas E Adams
National Weather Service
Ohio River Forecast Center
1901 South State Route 134
Wilmington, OH 45177

EMAIL:	[thomas.adams@noaa.gov](mailto:thomas.adams@noaa.gov)

VOICE:	937-383-0528
FAX:	937-383-0033

I'm using v.rast.stats but it is very slow. Is there another way?

Can't transform your vector into a raster and then use r.statistics?

cheers

-- Giovanni --

Hello,

The vector I’ve got is a grid 10x10 km, but it has some small irregular shapes, do you think it would be adequate for raster calculation?

And I need to calculate a large number of variables, for a large geographic area, using this vector and underlying rasters.

Frederico

2011/6/21 Giovanni Manghi <giovanni.manghi@gmail.com>

I’m using v.rast.stats but it is very slow. Is there another way?

Can’t transform your vector into a raster and then use r.statistics?

cheers

– Giovanni –

On Tue, Jun 21, 2011 at 6:10 PM, Frederico Mestre
<mestre.frederico@gmail.com> wrote:

Hello,
The vector I've got is a grid 10x10 km, but it has some small irregular
shapes, do you think it would be adequate for raster calculation?

Since you want to retrieve statistics from raster maps for vector
areas, the resolution of the raster maps should be used for the
computations. I think both v.rast.stats and v.rast.stats2 align the
region to the raster resolution. It can happen that areas smaller than
a single cell are skipped, because that level of detail is not present
in the raster map.

And I need to calculate a large number of variables, for a large geographic
area, using this vector and underlying rasters.

Use v.rast.stats2. It is much faster for vector maps with many areas
and also has fewer bugs than v.rast.stats. v.rast.stats and
v.rast.stats2 are both shell scripts, so you can just download
v.rast.stats2 and replace the existing v.rast.stats if installation
via g.extension fails.

Markus M