[GRASS-SVN] r30407 - in grass/trunk/scripts: v.rast.stats v.report
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Feb 29 18:01:04 EST 2008
Author: hamish
Date: 2008-02-29 18:01:03 -0500 (Fri, 29 Feb 2008)
New Revision: 30407
Modified:
grass/trunk/scripts/v.rast.stats/v.rast.stats
grass/trunk/scripts/v.report/v.report
Log:
observe layer (trac #75), quoting
Modified: grass/trunk/scripts/v.rast.stats/v.rast.stats
===================================================================
--- grass/trunk/scripts/v.rast.stats/v.rast.stats 2008-02-29 22:44:19 UTC (rev 30406)
+++ grass/trunk/scripts/v.rast.stats/v.rast.stats 2008-02-29 23:01:03 UTC (rev 30407)
@@ -197,7 +197,7 @@
#check if DBF driver used, in this case cut to 10 chars col names:
DBFDRIVER=0
-v.db.connect -g "$VECTOR" | cut -d' ' -f5 | grep -i dbf --quiet
+v.db.connect -g "$VECTOR" | grep -w "$GIS_OPT_LAYER" | cut -d' ' -f5 | grep -i dbf --quiet
if [ $? -eq 0 ] ; then
DBFDRIVER=1
else
@@ -209,7 +209,7 @@
DB_DATABASE="`v.db.connect -g "$VECTOR" | cut -d' ' -f4`"
#Find out which table is linked to the vector map on the given layer
-TABLE=`v.db.connect $VECTOR -g | grep -w $GIS_OPT_LAYER | awk '{print $2}'`
+TABLE=`v.db.connect map="$VECTOR" -g | grep -w "$GIS_OPT_LAYER" | awk '{print $2}'`
if [ -z "$TABLE" ] ; then
g.message -e 'There is no table connected to this map! Run v.db.connect or v.db.addtable first.'
exit 1
Modified: grass/trunk/scripts/v.report/v.report
===================================================================
--- grass/trunk/scripts/v.report/v.report 2008-02-29 22:44:19 UTC (rev 30406)
+++ grass/trunk/scripts/v.report/v.report 2008-02-29 23:01:03 UTC (rev 30407)
@@ -141,25 +141,26 @@
## NOTE: we suppress -1 cat and 0 cat
if [ $TABLEEXISTS -eq 1 ] ; then
- v.db.select -c map=$MAP layer=$LAYER | sort -n -t'|' -k 1 | grep -v '^0' > "$TMP1"
+ v.db.select -c map="$MAP" layer="$LAYER" | sort -n -t'|' -k 1 | grep -v '^0' > "$TMP1"
if [ `wc -l "$TMP1" | awk '{print $1}'` -eq 0 ] ; then
- KEY=`v.db.connect -g $GIS_OPT_MAP | cut -f3 -d" "`
+ KEY=`v.db.connect -g map="$GIS_OPT_MAP" | grep -w "$LAYER" | cut -f3 -d" "`
g.message -e "There is a table connected to input vector map '$MAP', but\
there are no categories present in the key column '$KEY'. Consider using\
v.to.db to correct this."
exit 1
fi
#fetch the requested attribute sorted by cat:
- v.to.db -p map=$MAP opt=$OPTION col=$COLUMS $UNITSPARAM \
- layer=$LAYER 2> /dev/null | grep -v '^cat' | grep -v '^-1' | grep -v '^0'\
+ v.to.db -p map="$MAP" opt="$OPTION" col="$COLUMS" "$UNITSPARAM" \
+ layer="$LAYER" 2> /dev/null | grep -v '^cat' | grep -v '^-1' | grep -v '^0'\
| sort -n -t'|' -k 1 | cut -d'|' -f2-4 > "$TMP2"
#make pre-table
paste -d'|' "$TMP1" "$TMP2" > "$TMP3"
else
- v.category input=$MAP layer=$LAYER option=print | sort -n | uniq | grep -v '^-1' | grep -v '^0' > "$TMP1"
+ v.category input="$MAP" layer="$LAYER" option=print | sort -n | uniq | \
+ grep -v '^-1' | grep -v '^0' > "$TMP1"
#make pre-table
- v.to.db -p map=$MAP opt=$OPTION col=$COLUMS $UNITSPARAM \
- layer=$LAYER 2> /dev/null | grep -v '^cat' | grep -v '^-1' | grep -v '^0'\
+ v.to.db -p map="$MAP" opt="$OPTION" col="$COLUMS" "$UNITSPARAM" \
+ layer="$LAYER" 2> /dev/null | grep -v '^cat' | grep -v '^-1' | grep -v '^0'\
| sort -n -t'|' -k 1 > "$TMP3"
fi
More information about the grass-commit
mailing list