[GRASS-SVN] r43607 - grass/branches/releasebranch_6_4/scripts/r.in.wms

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Sep 22 05:31:49 EDT 2010


Author: hamish
Date: 2010-09-22 09:31:49 +0000 (Wed, 22 Sep 2010)
New Revision: 43607

Modified:
   grass/branches/releasebranch_6_4/scripts/r.in.wms/r.in.wms
   grass/branches/releasebranch_6_4/scripts/r.in.wms/wms.request
Log:
backport many fixes from devbr6

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	2010-09-22 08:54:05 UTC (rev 43606)
+++ grass/branches/releasebranch_6_4/scripts/r.in.wms/r.in.wms	2010-09-22 09:31:49 UTC (rev 43607)
@@ -256,10 +256,6 @@
 # Remember the intial field seperator
 defaultIFS="$IFS"
 
-# Remember the previous path
-prevPATH="$PATH"
-PATH="$PATH:${GISBASE}/etc/r.in.wms/"
-export PATH
 
 #####################
 # name:     message
@@ -280,9 +276,6 @@
 exitprocedure()
 {
 	g.message -e 'User break!'
-	# is this bogus? won't PATH revert on exit anyway?
-	PATH="$prevPATH"
-	export PATH
 	\rm -f "${TEMPFILE}"*
 	exit 1
 }
@@ -396,7 +389,9 @@
 	if [ -x "`which xml2`" ] ; then
 		cat "$CAPABILITIES_FILE" | xml2 | \
 		  grep "Layer/SRS=\|Layer/Name=\|Layer/Title=\|Style/Name=\|Style/Title=\|Layer/Abstract=" | \
-		  sed -e "s/.*Layer\\/Name=/\n\nLAYER: /" \
+		  sed -e 's/.*Layer\\/Name=/\
+\
+LAYER: /' \
 		      -e "s/.*Layer\\/SRS=/  SRS: /" \
 		      -e "s/.*Layer\\/Title=/  Title: /" \
 		      -e "s/.*Layer\\/Abstract=/  |/" \
@@ -406,13 +401,19 @@
 
 	else : # xml2 is not available
 		g.message -w "The 'xml2' program was not found. Proceeding with internal XML parsing which may not be as reliable."
-		sed -e "s/<Layer/\n<Layer/g" \
-		    -e "s/<Name>/\n<Name>/g" \
-		    -e "s/<Style>/\n<Style>/g" \
-		    -e "s/<Title>/\n<Title>/g" \
+		sed -e 's/<Layer/\
+<Layer/g' \
+		    -e 's/<Name>/\
+<Name>/g' \
+		    -e 's/<Style>/\
+<Style>/g' \
+		    -e 's/<Title>/\
+<Title>/g' \
 		    "$CAPABILITIES_FILE" | \
 		    grep "Name\|Title\|Style\|Layer" | \
-		    sed -e "s/<Layer .*>/-=-=-=-=-\n\nLAYER:/" \
+		    sed -e 's/<Layer .*>/-=-=-=-=-\
+\
+LAYER:/' \
 		      -e "s/<\/Layer.*>//" \
 		      -e "s/<Name>\s*\([^<]*\)/~\1~/g" \
 		      -e "s/<\/Name>\n\?//g" \
@@ -511,7 +512,7 @@
 
 if [ $GIS_FLAG_D -eq 0 ] ; then
 	message 1 "wms.request $REQUEST"
-	eval "wms.request $REQUEST"
+	eval "\"$GISBASE/etc/r.in.wms/wms.request\" $REQUEST"
 	if [ $? -ne 0 ] ; then
 	   g.message -e "wms.request failure" 
 	   exit 1
@@ -524,7 +525,7 @@
 addargument DOWNLOAD curloptions "${GIS_OPT_CURLOPTIONS}"
 
 message 1 "wms.download $DOWNLOAD"
-eval "wms.download $DOWNLOAD"
+eval "\"$GISBASE/etc/r.in.wms/wms.download\" $DOWNLOAD"
 
 # Job 2: make list of files
 
@@ -560,7 +561,7 @@
 fi
 
 message 1 "r.in.gdalwarp $GDALWARP"
-eval "r.in.gdalwarp $GDALWARP"
+eval "\"$GISBASE/etc/r.in.wms/r.in.gdalwarp\" $GDALWARP"
 if [ $? -ne 0 ] ; then
    g.message -e message="r.in.gdalwarp failed"
    exit 1

Modified: grass/branches/releasebranch_6_4/scripts/r.in.wms/wms.request
===================================================================
--- grass/branches/releasebranch_6_4/scripts/r.in.wms/wms.request	2010-09-22 08:54:05 UTC (rev 43606)
+++ grass/branches/releasebranch_6_4/scripts/r.in.wms/wms.request	2010-09-22 09:31:49 UTC (rev 43607)
@@ -132,20 +132,7 @@
 
 g.message -d "[wms.request]"
 
-SED="sed"
-GREP="grep"
-# check if we have sed
-if [ ! -x "`which $SED`" ] ; then
-    g.message "$SED is required, please install it first"
-    exit 1
-fi
 
-# check if we have grep
-if [ ! -x "`which $GREP`" ] ; then
-    g.message "$GREP is required, please install it first"
-    exit 1
-fi
-
 # Remember the intial field seperator
 defaultIFS="$IFS"
 
@@ -269,18 +256,27 @@
 
 SERVER="${GIS_OPT_MAPSERVER}"
 SRS="${GIS_OPT_SRS}"
+# use `tr '[:upper:]' '[:lower:]'` instead?
 SRS_lower=`echo $SRS | sed "y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/"`
 
 
 # If the user asserts that this projection is the same as the source
 # use this projection as the source to get a trivial tiling from r.tileset
 if [ $GIS_FLAG_P -eq 1 ] ; then
-	PROJ4_SRS=`g.proj -j`
-	eval `g.proj -p | $GREP meters | $SED "s/\\s*:\\s*/=/"`
-	SRS_SCALE=$meters;
+
+    PROJ4_SRS=`g.proj -j | (
+	PROJ4_SRS=
+	while read line ; do
+	    PROJ4_SRS="$PROJ4_SRS '$line'"
+	done
+	echo "$PROJ4_SRS"
+    )`
+
+    eval `g.proj -p | grep ^meters | sed "s/\\s*:\\s*/=/"`
+    SRS_SCALE=$meters;
 else
-	PROJ4_SRS="+init=$SRS_lower"
-	SRS_SCALE=1
+    PROJ4_SRS="+init=$SRS_lower"
+    SRS_SCALE=1
 fi
 
 WMS_QUERY="${GIS_OPT_WMSQUERY}"



More information about the grass-commit mailing list