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?
Thanks a lot,
Sonja
#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
On Fri, Nov 26, 2010 at 2:22 PM, sonja1 <sonja.jankowfsky@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
On Fri, Nov 26, 2010 at 2:22 PM, sonja1 <sonja.jankowfsky@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