[GRASS5] New thematic mapper for GRASS 6

Martin Landa landa at gama.fsv.cvut.cz
Mon May 16 10:41:35 EDT 2005


Hi,

maybe I am wrong, but wouldn't be possible to determine table name from the layer option?
Is the table option really needed?

Martin

--
Martin Landa <landa at gama.fsv.cvut.cz> * http://gama.fsv.cvut.cz/~landa *
CTU Prague, Faculty of Civil Engineering, Czech Republic
-------------- next part --------------
--- d.vect.thematic.old	2005-05-16 16:16:51.000000000 +0200
+++ d.vect.thematic	2005-05-16 16:27:41.000000000 +0200
@@ -42,13 +42,6 @@
 #% required : yes
 #%end
 #%option
-#% key: table
-#% type: string
-#% gisprompt: old,vector,vector
-#% description: Name of attribute table connected to vector map (defaults to vector map name - for native GRASS dbf tables)
-#% required : no
-#%end
-#%option
 #% key: column
 #% type: string
 #% description: Column to use for thematic display (must be numeric)
@@ -148,13 +141,16 @@
 # shell check for user break (signal list: trap -l)
 trap "exitprocedure" 2 3 15
 
-if [ -z "$GIS_OPT_table" ] ; then
-	GIS_OPT_table=$GIS_OPT_map
+table=`v.db.connect $GIS_OPT_map -g | grep -w $GIS_OPT_layer | awk '{print $2}'`
+if [ -z "$table" ]
+    then
+    echo "Layer <$GIS_OPT_layer> doesn't exist!"
+    exit 1
 fi
 
 # Calculate statistics for thematic intervals
 #v.db.connect map=fields2 -pg | awk '{print $5}'
-v.univar.sh -e table=$GIS_OPT_table column=$GIS_OPT_column > TMP1
+v.univar.sh -e table=$table column=$GIS_OPT_column > TMP1
 min="`grep 'Minimum:' TMP1 | sed s/Minimum://`"
 max="`grep 'Maximum:' TMP1 | sed s/Maximum://`"
 mean="`grep 'Mean:' TMP1 | sed s/Mean://`"
@@ -186,7 +182,7 @@
 # legend title
 echo ""
 echo ""
-echo "Thematic map legend for column $GIS_OPT_column of map $GIS_OPT_map"
+echo "Thematic map legend for column $GIS_OPT_column of map $GIS_OPT_map (layer/table $GIS_OPT_layer/$table)"
 echo ""
 echo "Value range: $min - $max"
 


More information about the grass-dev mailing list