[GRASS-SVN] r55725 - in grass/branches/releasebranch_6_4/scripts: d.rast.leg db.droptable i.image.mosaic r.in.srtm r.in.wms v.in.garmin

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Apr 12 20:32:00 PDT 2013


Author: hamish
Date: 2013-04-12 20:32:00 -0700 (Fri, 12 Apr 2013)
New Revision: 55725

Modified:
   grass/branches/releasebranch_6_4/scripts/d.rast.leg/d.rast.leg
   grass/branches/releasebranch_6_4/scripts/db.droptable/db.droptable
   grass/branches/releasebranch_6_4/scripts/i.image.mosaic/i.image.mosaic
   grass/branches/releasebranch_6_4/scripts/r.in.srtm/r.in.srtm
   grass/branches/releasebranch_6_4/scripts/r.in.wms/r.in.wms
   grass/branches/releasebranch_6_4/scripts/v.in.garmin/v.in.garmin
Log:
better handle spaces in GISDBASE (#1683), cases where it's a bugfix on WinGrass (backport from devbr6)

Modified: grass/branches/releasebranch_6_4/scripts/d.rast.leg/d.rast.leg
===================================================================
--- grass/branches/releasebranch_6_4/scripts/d.rast.leg/d.rast.leg	2013-04-13 03:08:50 UTC (rev 55724)
+++ grass/branches/releasebranch_6_4/scripts/d.rast.leg/d.rast.leg	2013-04-13 03:32:00 UTC (rev 55725)
@@ -117,15 +117,12 @@
 fi
 
 #for -n flag of d.legend
-eval `g.findfile el=cell file=$GIS_OPT_MAP`
+eval `g.findfile el=cell file="$GIS_OPT_MAP"`
 if [ ! "$file" ] ; then
    g.message -e "Raster map '$GIS_OPT_MAP' not found in mapset search path"
    exit 1
 fi
-filemapset="${mapset}"
-# would it be better to search for cats/ file ??
-eval `g.gisenv`
-HISTFILEDIR=$GISDBASE/$LOCATION_NAME/$filemapset/cell_misc/
+
 eval `r.info -t "$GIS_OPT_MAP"`
 
 # for rast=
@@ -137,6 +134,12 @@
     else
 	eval `r.info -t "$GIS_OPT_RAST"`
     fi
+
+    eval `g.findfile ele=cell_misc file="$GIS_OPT_RAST" | grep '^file='`
+    HSTGRM_DIR="$file"
+else
+    eval `g.findfile ele=cell_misc file="$GIS_OPT_MAP" | grep '^file='`
+    HSTGRM_DIR="$file"
 fi
 
 
@@ -167,14 +170,16 @@
     	d.frame -s at=0,90,$XPOS,100 frame=right
 	if [ -z "$GIS_OPT_RAST" ] ; then
 		g.message -d "No lines; own legend"
-		if test -f $HISTFILEDIR/$GIS_OPT_MAP/histogram ; then
+		# HB: I'm not sure this works as written. e.g. try erode.index at spearfish
+		# would it be better to search for cats/ file ??
+		if test -f "$HSTGRM_DIR/histogram" ; then
 	  	     d.legend $FLIP $SMOOTH -n map="$GIS_OPT_MAP" $LEG_AT
         	else
 	             d.legend $FLIP $SMOOTH $OMIT map="$GIS_OPT_MAP" $LEG_AT
         	fi
 	else
 		g.message -d "No lines; external legend"
-		if test -f $HISTFILEDIR/$GIS_OPT_RAST/histogram ; then
+		if test -f "$HSTGRM_DIR/histogram" ; then
 		     d.legend $FLIP $SMOOTH -n map="$GIS_OPT_RAST" $LEG_AT
 		else
 		     d.legend $FLIP $SMOOTH $OMIT map="$GIS_OPT_RAST" $LEG_AT
@@ -195,7 +200,7 @@
     	d.frame -s at=0,90,$XPOS,100 frame=right
 	if [ -z "$GIS_OPT_RAST" ] ; then
 		g.message -d message="Lines=$GIS_OPT_NUM_OF_LINES; own legend"
-		if test -f $HISTFILEDIR/$GIS_OPT_MAP/histogram ; then
+		if test -f "$HSTGRM_DIR/histogram" ; then
 	             d.legend $FLIP -n map="$GIS_OPT_MAP" \
 			lines="$GIS_OPT_NUM_OF_LINES" $LEG_AT
         	else
@@ -203,7 +208,7 @@
         	fi
 	else
 		g.message -d message="Lines=$GIS_OPT_NUM_OF_LINES; external legend"
-		if test -f $HISTFILEDIR/$GIS_OPT_RAST/histogram ; then
+		if test -f "$HSTGRM_DIR/histogram" ; then
 		     d.legend $FLIP -n map="$GIS_OPT_RAST" \
 			lines="$GIS_OPT_NUM_OF_LINES" $LEG_AT
 		else

Modified: grass/branches/releasebranch_6_4/scripts/db.droptable/db.droptable
===================================================================
--- grass/branches/releasebranch_6_4/scripts/db.droptable/db.droptable	2013-04-13 03:08:50 UTC (rev 55724)
+++ grass/branches/releasebranch_6_4/scripts/db.droptable/db.droptable	2013-04-13 03:32:00 UTC (rev 55725)
@@ -42,8 +42,6 @@
   exec g.parser "$0" "$@"
 fi
 
-PROG=`basename "$0"`
-
 # setting environment, so that awk works properly in all languages
 unset LC_ALL
 LC_NUMERIC=C
@@ -59,8 +57,8 @@
 trap "exitprocedure" 2 3 15
 
 ### setup enviro vars ###
-eval `g.gisenv`
-: ${GISBASE?} ${GISDBASE?} ${LOCATION_NAME?} ${MAPSET?}
+LOCATION_NAME=`g.gisenv get=LOCATION_NAME`
+GISDBASE=`g.gisenv get=GISDBASE`
 
 table="$GIS_OPT_TABLE"
 

Modified: grass/branches/releasebranch_6_4/scripts/i.image.mosaic/i.image.mosaic
===================================================================
--- grass/branches/releasebranch_6_4/scripts/i.image.mosaic/i.image.mosaic	2013-04-13 03:08:50 UTC (rev 55724)
+++ grass/branches/releasebranch_6_4/scripts/i.image.mosaic/i.image.mosaic	2013-04-13 03:32:00 UTC (rev 55725)
@@ -69,7 +69,6 @@
     exec g.parser "$0" "$@"
 fi
 
-PROG=`basename "$0"`
 
 #### check if we have awk
 if [ ! -x "`which awk`" ] ; then
@@ -82,8 +81,10 @@
 LC_NUMERIC=C
 export LC_NUMERIC
    
-eval `g.gisenv`
-: ${GISBASE?} ${GISDBASE?} ${LOCATION_NAME?} ${MAPSET?}
+### setup enviro vars ###
+MAPSET=`g.gisenv get=MAPSET`
+LOCATION_NAME=`g.gisenv get=LOCATION_NAME`
+GISDBASE=`g.gisenv get=GISDBASE`
 CURRLOCATION="$GISDBASE/$LOCATION_NAME/$MAPSET"
 
 g.message -w message='Do not forget to set region properly to cover all images!'

Modified: grass/branches/releasebranch_6_4/scripts/r.in.srtm/r.in.srtm
===================================================================
--- grass/branches/releasebranch_6_4/scripts/r.in.srtm/r.in.srtm	2013-04-13 03:08:50 UTC (rev 55724)
+++ grass/branches/releasebranch_6_4/scripts/r.in.srtm/r.in.srtm	2013-04-13 03:32:00 UTC (rev 55725)
@@ -102,15 +102,11 @@
 LC_NUMERIC=C
 export LC_NUMERIC
 
-eval `g.gisenv`
-: ${GISBASE?} ${GISDBASE?} ${LOCATION_NAME?} ${MAPSET?}
-LOCATION="$GISDBASE/$LOCATION_NAME/$MAPSET"
-PERM="$GISDBASE/$LOCATION_NAME/PERMANENT"
 
-grep -i 'proj: ll' "$PERM/PROJ_INFO" > /dev/null
-if [ $? -ne 0 ] ; then
+PROJ_TYPE=`g.region -p | grep '^proj' | cut -f2 -d" "`
+if [ "$PROJ_TYPE" -ne 3 ] ; then
     g.message -e "SRTM data are in Latitude/Longitude. The current\
-      location's projection differs. STOP."
+      location's projection differs. Quitting."
     exit 1
 fi
 

Modified: grass/branches/releasebranch_6_4/scripts/r.in.wms/r.in.wms
===================================================================
--- grass/branches/releasebranch_6_4/scripts/r.in.wms/r.in.wms	2013-04-13 03:08:50 UTC (rev 55724)
+++ grass/branches/releasebranch_6_4/scripts/r.in.wms/r.in.wms	2013-04-13 03:32:00 UTC (rev 55725)
@@ -467,14 +467,14 @@
 DOWNLOAD=""
 GDALWARP=""
 
-eval `g.gisenv`
-
 #Job number one: pick a folder
-if [ -z "${GIS_OPT_FOLDER}" ] ; then
-	GIS_OPT_FOLDER="${GISDBASE}/wms_download"
+if [ -z "$GIS_OPT_FOLDER" ] ; then
+    GISDBASE=`g.gisenv get=GISDBASE`
+    GIS_OPT_FOLDER="$GISDBASE/wms_download"
 fi
 
-PREFIX="${GIS_OPT_OUTPUT}"
+
+PREFIX="$GIS_OPT_OUTPUT"
 if [ -x "`which wget`" ] ; then
     REQUESTFILE="${GIS_OPT_FOLDER}/${PREFIX}_${GIS_OPT_REGION}.wget"
 else

Modified: grass/branches/releasebranch_6_4/scripts/v.in.garmin/v.in.garmin
===================================================================
--- grass/branches/releasebranch_6_4/scripts/v.in.garmin/v.in.garmin	2013-04-13 03:08:50 UTC (rev 55724)
+++ grass/branches/releasebranch_6_4/scripts/v.in.garmin/v.in.garmin	2013-04-13 03:32:00 UTC (rev 55725)
@@ -105,9 +105,11 @@
 LC_NUMERIC=C
 export LC_NUMERIC
 
-eval `g.gisenv`
-: ${GISBASE?} ${GISDBASE?} ${LOCATION_NAME?} ${MAPSET?}
-LOCATION="$GISDBASE"/"$LOCATION_NAME"/"$MAPSET"
+### setup enviro vars ###
+MAPSET=`g.gisenv get=MAPSET`
+LOCATION_NAME=`g.gisenv get=LOCATION_NAME`
+GISDBASE=`g.gisenv get=GISDBASE`
+LOCATION="$GISDBASE/$LOCATION_NAME/$MAPSET"
 
 PROG=`basename "$0"`
 



More information about the grass-commit mailing list