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

Sonja Jankowfsky sonja.jankowfsky at cemagref.fr
Fri Nov 26 09:12:39 EST 2010


Markus Metz a écrit :

> 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
>>
>>     
Thanks a lot, this seems to work!!!

-- 
Sonja Jankowfsky
UR Hydrologie-Hydraulique
Cemagref de Lyon
3 bis quai Chauveau CP 220
69336 Lyon Cedex 09
FRANCE
Tel : (+33)4 72 20 86 11 	 
Fax : (+33)4 78 47 78 75 




More information about the grass-user mailing list