[GRASS-SVN] r56215 - grass/branches/develbranch_6/scripts/r.in.wms

svn_grass at osgeo.org svn_grass at osgeo.org
Sun May 12 05:28:51 PDT 2013


Author: hamish
Date: 2013-05-12 05:28:50 -0700 (Sun, 12 May 2013)
New Revision: 56215

Modified:
   grass/branches/develbranch_6/scripts/r.in.wms/wms.download
   grass/branches/develbranch_6/scripts/r.in.wms/wms.request
Log:
avoid wingrass quoting headaches by converting to msysized pathnames. MSYS detection code borrowed from init.sh

Modified: grass/branches/develbranch_6/scripts/r.in.wms/wms.download
===================================================================
--- grass/branches/develbranch_6/scripts/r.in.wms/wms.download	2013-05-12 12:00:26 UTC (rev 56214)
+++ grass/branches/develbranch_6/scripts/r.in.wms/wms.download	2013-05-12 12:28:50 UTC (rev 56215)
@@ -158,7 +158,7 @@
 #Get the data from the WMS server
 GetData() {
    g.message "Downloading data"
-   g.message -v message="Requesting Data from <${SERVER}>:"
+   g.message -v message="Requesting data from <$SERVER>:"
    g.message -v message="$STRING"
 
    if [ "$POST_DATA_OK" -eq 1 ] ; then

Modified: grass/branches/develbranch_6/scripts/r.in.wms/wms.request
===================================================================
--- grass/branches/develbranch_6/scripts/r.in.wms/wms.request	2013-05-12 12:00:26 UTC (rev 56214)
+++ grass/branches/develbranch_6/scripts/r.in.wms/wms.request	2013-05-12 12:28:50 UTC (rev 56215)
@@ -133,6 +133,26 @@
 g.message -d "[wms.request]"
 
 
+# Get the system name
+SYSTEM=`uname -s`
+case $SYSTEM in
+MINGW* | MSYS*)
+        MINGW=1
+        ;;
+CYGWIN*)
+        CYGWIN=1
+        ;;
+Darwin*)
+        MACOSX=1
+        ;;
+esac
+
+# in case of fire, break glass
+dos2unix_path()
+{
+   echo "$1" | sed -e 's|^\([A-Za-z]\):|/\1|' -e 's|\\|/|g'
+}
+
 # Remember the intial field seperator
 defaultIFS="$IFS"
 
@@ -227,7 +247,13 @@
 	SIZE="bbox=$w,$s,$e,$n&width=$cols&height=$rows"
 	message 1 "$SIZE"
 	IMAGEFILE="${FOLDERPLUS}_$NUMBER_OF_TILES"
-	OUTPUT_FILE="${IMAGEFILE}${FILE_EXTENT}"
+
+	if [ "$MINGW" ] ; then
+	    OUTPUT_FILE=`dos2unix_path "${IMAGEFILE}${FILE_EXTENT}"`
+	else
+	    OUTPUT_FILE="${IMAGEFILE}${FILE_EXTENT}"
+	fi
+
 	# We could add world files here to help out gdalwarp.
 	# And here it is:
 	# Displacement from top left cell to the one to the right of it and to the one below it:
@@ -245,7 +271,7 @@
 	echo "$top_left_cell_center_y" >> "${IMAGEFILE}${WORLDFILE}"
 	#Make the requestt for data:
 	STRING="request=GetMap&layers=${GIS_OPT_LAYERS}&styles=${GIS_OPT_STYLES}&srs=${SRS}&${SIZE}&format=${FORMAT}&${TRANSPARENCY}&${WMS_QUERY}"
-	echo "OUTPUT_FILE=\"${OUTPUT_FILE}\";SERVER=\"${SERVER}\";STRING=\"${STRING}\"" >> "${REQUESTFILE}"
+	echo "OUTPUT_FILE=\"$OUTPUT_FILE\";SERVER=\"$SERVER\";STRING=\"$STRING\"" >> "$REQUESTFILE"
 
 	NUMBER_OF_TILES=`expr "$NUMBER_OF_TILES" + 1`
   done



More information about the grass-commit mailing list