[GRASS-user] v.rast.stats (r.category) fail?

Annalisa wrote:

I'm experiencing some problems with v.rast.stats
and (I suppose) v.category.

I have a lines vector file and I want to obtain
some statistics on each feature.

...

I made an attempt with the NC spm dataset: I
took the elevation@PERMANENT map and the
streams@PERMANENT (vector), I copied the streams
in user1 mapset, set DEBUG at "2" and obtained:

GRASS 6.5.svn (nc_spm_08):~ > v.rast.stats
vector=streams@user1 layer=1
raster=elevation@PERMANENT colprefix=stats
percentile=90 --verbose

...

ERROR: No categories found in raster map

Hi,

v.rast.stats was only designed to work on vector
areas, not lines.

NAME
       v.rast.stats - Calculates univariate statistics from a
       raster map based on vector polygons and uploads statistics
       to new attribute columns.

...
# PURPOSE: Calculates univariate statistics from a GRASS raster map
# only for areas covered by vector objects on a per-category base
#

... and internally it runs "v.to.rast .. type=area"

you might try editing the script to change that
type=area to type=area,line. Maybe it works, or
maybe it violates some other assumption. not really
sure.

Hamish

On Sat, Dec 10, 2011 at 11:19 PM, Hamish <hamish_b@yahoo.com> wrote:

Annalisa wrote:

I'm experiencing some problems with v.rast.stats
and (I suppose) v.category.

I have a lines vector file and I want to obtain
some statistics on each feature.

...

GRASS 6.5.svn (nc_spm_08):~ > v.rast.stats
vector=streams@user1 layer=1
raster=elevation@PERMANENT colprefix=stats
percentile=90 --verbose

...

ERROR: No categories found in raster map

(btw: this error also occurs if the computation (current) region
is outside the raster map - a bit misleading in this case)

v.rast.stats was only designed to work on vector
areas, not lines.

I have now added a test in GRASS 6 to fail on vector maps
without areas.
TBD for GRASS 7.

Markus