[GRASS-user] v.rast.stats No categories found in raster map

Markus Metz markus.metz.giswork at googlemail.com
Fri Nov 26 09:02:27 EST 2010


On Fri, Nov 26, 2010 at 2:22 PM, sonja1 <sonja.jankowfsky at cemagref.fr> wrote:
>
> Hi,
> I'm trying to run the v.rast.stats script using a vector map and a dem as
> input.
> The strange thing is, that for one vector map the script works fine, and for
> another vector map I get the error "No categories found in raster map". As
> far as I understood, this error is related to the vector map, not the raster
> map due to the following lines in the v.rast.stats script. So, I thought
> this might be related to a bad topology of the vector map. But even a test
> case with only 1 polygon gives me the "No categories found" error. I checked
> the vector maps, but in every map I have categories and centroids.
> Does anybody know how to resolve this problem?

Try to set the region to the vector, align it to the raster you want to query
g.region vect=vector align=raster

Markus M

>
> #prepare raster MASK
> v.to.rast in="$VECTOR" out="${VECTOR}_${TMPNAME}" use=cat --quiet
> if [ $? -ne 0 ] ; then
>   g.message -e "An error occurred while converting vector to raster"
>   cleanup
>   exit 1
> fi
>
>
> #dump cats to file to avoid "too many argument" problem:
> r.category "${VECTOR}_${TMPNAME}" fs=';' --quiet | cut -d';' -f1 >
> "$TEMPFILE.cats"
> #echo "List of categories found: $CATSLIST"
> NUMBER=`cat "$TEMPFILE.cats" | wc -l | awk '{print $1}'`
> if [ $NUMBER -lt 1 ] ; then
>   g.message -e "No categories found in raster map"
>   cleanup
>   exit 1
> fi
>
>
>
> --
> View this message in context: http://osgeo-org.1803224.n2.nabble.com/v-rast-stats-No-categories-found-in-raster-map-tp5777233p5777233.html
> Sent from the Grass - Users mailing list archive at Nabble.com.
> _______________________________________________
> grass-user mailing list
> grass-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-user
>


More information about the grass-user mailing list