[GRASS-SVN] r56231 - in grass/branches/releasebranch_6_4/scripts: r.in.wms r.tileset
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon May 13 02:08:40 PDT 2013
Author: hamish
Date: 2013-05-13 02:08:40 -0700 (Mon, 13 May 2013)
New Revision: 56231
Modified:
grass/branches/releasebranch_6_4/scripts/r.in.wms/r.in.gdalwarp
grass/branches/releasebranch_6_4/scripts/r.in.wms/r.in.wms
grass/branches/releasebranch_6_4/scripts/r.in.wms/wms.download
grass/branches/releasebranch_6_4/scripts/r.in.wms/wms.request
grass/branches/releasebranch_6_4/scripts/r.tileset/r.tileset
Log:
quote variables and fix space in pathname issues. now works for wingrass, sometimes. (#820)
Modified: grass/branches/releasebranch_6_4/scripts/r.in.wms/r.in.gdalwarp
===================================================================
--- grass/branches/releasebranch_6_4/scripts/r.in.wms/r.in.gdalwarp 2013-05-13 08:47:53 UTC (rev 56230)
+++ grass/branches/releasebranch_6_4/scripts/r.in.wms/r.in.gdalwarp 2013-05-13 09:08:40 UTC (rev 56231)
@@ -82,6 +82,8 @@
g.message -d "[r.in.gdalwarp]"
+PROG=`basename "$0"`
+
#### setup temporary file
TEMPFILE="`g.tempfile pid=$$`"
if [ $? -ne 0 ] || [ -z "$TEMPFILE" ] ; then
@@ -128,7 +130,7 @@
"$FILE" "$WARPFILE" $GIS_OPT_WARPOPTIONS $METHOD
if [ $? -ne 0 ] ; then
- g.message -e message="`basename $0`: gdalwarp failure."
+ g.message -e message="$PROG: gdalwarp failure."
rm -f "${TEMPFILE}"*
exit 1
fi
@@ -136,7 +138,7 @@
#Import it into a temporary map:
r.in.gdal $FLAGS input="$WARPFILE" output="$TMPMAPNAME" --quiet
if [ $? -ne 0 ] ; then
- g.message -e message="`basename $0`: r.in.gdal failure."
+ g.message -e message="$PROG: r.in.gdal failure."
rm -f "${TEMPFILE}"*
exit 1
fi
@@ -161,17 +163,17 @@
SUFFIXES=`echo "$SUFFIXES
$CHANNEL_SUFFIXES" | sort -u`
- IFS=$defaultIFS
+ IFS="$defaultIFS"
for SUFFIX in $CHANNEL_SUFFIXES ; do
eval "$SUFFIX"
- LAST_SUFFIX=$sfx
+ LAST_SUFFIX="$sfx"
done
# Find the alpha layer
if [ $GIS_FLAG_K -eq 1 ] ; then
- ALPHALAYER=${TMPMAPNAME}${LAST_SUFFIX}
+ ALPHALAYER="${TMPMAPNAME}${LAST_SUFFIX}"
else
- ALPHALAYER=${TMPMAPNAME}.alpha
+ ALPHALAYER="${TMPMAPNAME}.alpha"
fi
# test to see if the alpha map exists
g.findfile element=cell file="$ALPHALAYER" > /dev/null
@@ -204,7 +206,7 @@
fi
# Copy the color tables:
- r.colors map=${MAP}${sfx} rast=${TMPMAPNAME}${sfx} --quiet
+ r.colors map="${MAP}${sfx}" rast="${TMPMAPNAME}${sfx}" --quiet
# Make patch lists:
sfx2=`echo $sfx | sed "s/\./_/"`
@@ -236,7 +238,7 @@
r.in.gdal -o $FLAGS input="$FILE" output="$MAP" --quiet
if [ $? -ne 0 ] ; then
- g.message -e message="`basename $0`: r.in.gdal failure."
+ g.message -e message="$PROG: r.in.gdal failure."
rm -f "${TEMPFILE}"*
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-05-13 08:47:53 UTC (rev 56230)
+++ grass/branches/releasebranch_6_4/scripts/r.in.wms/r.in.wms 2013-05-13 09:08:40 UTC (rev 56231)
@@ -263,10 +263,10 @@
# usage: message level text
message () {
- if [ $1 -lt $GIS_OPT_V ] ; then
- shift
- echo "$@" 1>&2
- fi
+ if [ "$1" -lt "$GIS_OPT_V" ] ; then
+ shift
+ echo "$@" 1>&2
+ fi
}
#######################################################################
@@ -275,9 +275,9 @@
#
exitprocedure()
{
- g.message -e 'User break!'
- \rm -f "${TEMPFILE}"*
- exit 1
+ g.message -e 'User break!'
+ rm -f "$TEMPFILE"*
+ exit 1
}
trap "exitprocedure" 2 3 15
@@ -289,11 +289,11 @@
# purpose: make arguments for a sub command
#
addargument() {
- if [ -z "$3" ] ; then
- message 1 "Skipping argument for $2"
- else
- eval "$1=\"\$$1 '$2=$3'\""
- fi
+ if [ -z "$3" ] ; then
+ message 1 "Skipping argument for $2"
+ else
+ eval "$1=\"\$$1 '$2=$3'\""
+ fi
}
#######################################################################
@@ -301,9 +301,9 @@
# purpose: make arguments for a sub command
#
addflag() {
- if [ $3 -eq 1 ] ; then
- eval "$1=\"\$$1 -$2\""
- fi
+ if [ $3 -eq 1 ] ; then
+ eval "$1=\"\$$1 -$2\""
+ fi
}
######################
@@ -312,9 +312,9 @@
# usage: varname "expr"
calculate() {
- message 3 "$2"
- c_tmp=`echo "$2" | $BC $BCARGS`
- eval $1=$c_tmp
+ message 3 "$2"
+ c_tmp=`echo "$2" | "$BC" "$BCARGS"`
+ eval $1=$c_tmp
}
@@ -347,7 +347,7 @@
if [ ! -e "$CAPABILITIES_FILE" ] ; then
g.message -e "Downloading XML file"
- \rm "$TEMPFILE"
+ rm -f "$TEMPFILE"
exit 1
fi
@@ -375,13 +375,13 @@
if [ ! -e "$CAPABILITIES_FILE" ] ; then
g.message -e "Downloading XML file"
- \rm "$TEMPFILE"
+ rm -f "$TEMPFILE"
exit 1
fi
if [ `wc -c < "$CAPABILITIES_FILE"` -eq 0 ] ; then
g.message -e "Downloaded XML file was empty"
- \rm -f "$CAPABILITIES_FILE" "$TEMPFILE"
+ rm -f "$CAPABILITIES_FILE" "$TEMPFILE"
exit 1
fi
@@ -458,9 +458,9 @@
#### Exit if there is no map
# It would be a good idea to test if the map already exists here too
-if [ -z "${GIS_OPT_OUTPUT}" ] ; then
- g.message -e "No output map specified"
- exit 1;
+if [ -z "$GIS_OPT_OUTPUT" ] ; then
+ g.message -e "No output map specified"
+ exit 1
fi
REQUEST=""
@@ -476,9 +476,9 @@
PREFIX="$GIS_OPT_OUTPUT"
if [ -x "`which wget`" ] ; then
- REQUESTFILE="${GIS_OPT_FOLDER}/${PREFIX}_${GIS_OPT_REGION}.wget"
+ REQUESTFILE="$GIS_OPT_FOLDER/${PREFIX}_$GIS_OPT_REGION.wget"
else
- REQUESTFILE="${GIS_OPT_FOLDER}/${PREFIX}_${GIS_OPT_REGION}.curl"
+ REQUESTFILE="$GIS_OPT_FOLDER/${PREFIX}_$GIS_OPT_REGION.curl"
fi
if [ ! -z "$GIS_OPT_REGION" ] ; then
@@ -494,21 +494,21 @@
LAYERS=`echo ${GIS_OPT_LAYERS} | sed -e 's/ /%20/g'`
-addflag REQUEST o ${GIS_FLAG_O}
-addflag REQUEST c ${GIS_FLAG_C}
-addflag REQUEST p ${GIS_FLAG_P}
-addargument REQUEST folder "${GIS_OPT_FOLDER}"
-addargument REQUEST prefix "${PREFIX}"
-addargument REQUEST region "${GIS_OPT_REGION}"
-addargument REQUEST mapserver "${GIS_OPT_MAPSERVER}"
-addargument REQUEST layers "${LAYERS}"
-addargument REQUEST styles "${GIS_OPT_STYLES}"
-addargument REQUEST srs "${GIS_OPT_SRS}"
-addargument REQUEST format "${GIS_OPT_FORMAT}"
-addargument REQUEST wmsquery "${GIS_OPT_WMSQUERY}"
-addargument REQUEST maxcols "${GIS_OPT_MAXCOLS}"
-addargument REQUEST maxrows "${GIS_OPT_MAXROWS}"
-addargument REQUEST tileoptions "${GIS_OPT_TILEOPTIONS}"
+addflag REQUEST o "$GIS_FLAG_O"
+addflag REQUEST c "$GIS_FLAG_C"
+addflag REQUEST p "$GIS_FLAG_P"
+addargument REQUEST folder "$GIS_OPT_FOLDER"
+addargument REQUEST prefix "$PREFIX"
+addargument REQUEST region "$GIS_OPT_REGION"
+addargument REQUEST mapserver "$GIS_OPT_MAPSERVER"
+addargument REQUEST layers "$LAYERS"
+addargument REQUEST styles "$GIS_OPT_STYLES"
+addargument REQUEST srs "$GIS_OPT_SRS"
+addargument REQUEST format "$GIS_OPT_FORMAT"
+addargument REQUEST wmsquery "$GIS_OPT_WMSQUERY"
+addargument REQUEST maxcols "$GIS_OPT_MAXCOLS"
+addargument REQUEST maxrows "$GIS_OPT_MAXROWS"
+addargument REQUEST tileoptions "$GIS_OPT_TILEOPTIONS"
if [ $GIS_FLAG_D -eq 0 ] ; then
message 1 "wms.request $REQUEST"
@@ -519,44 +519,48 @@
fi
fi
-addflag DOWNLOAD g ${GIS_FLAG_G}
-addargument DOWNLOAD requestfile "${REQUESTFILE}"
-addargument DOWNLOAD wgetoptions "${GIS_OPT_WGETOPTIONS}"
-addargument DOWNLOAD curloptions "${GIS_OPT_CURLOPTIONS}"
+addflag DOWNLOAD g "$GIS_FLAG_G"
+addargument DOWNLOAD requestfile "$REQUESTFILE"
+addargument DOWNLOAD wgetoptions "$GIS_OPT_WGETOPTIONS"
+addargument DOWNLOAD curloptions "$GIS_OPT_CURLOPTIONS"
message 1 "wms.download $DOWNLOAD"
eval "\"$GISBASE/etc/r.in.wms/wms.download\" $DOWNLOAD"
+
# Job 2: make list of files
-CONTENTS=`cat "${REQUESTFILE}"`
-
FILES=""
COUNT=0
-for line in $CONTENTS ; do
- eval "$line"
- if [ $COUNT -eq 0 ] ; then
- FILES="$OUTPUT_FILE"
- else
- FILES="$FILES,$OUTPUT_FILE"
- fi
- COUNT=`expr $COUNT + 1`
-done
+while read line ; do
+ if [ -z "$line" ] ; then
+ continue
+ fi
+ eval "$line"
+ if [ "$COUNT" -eq 0 ] ; then
+ FILES="$OUTPUT_FILE"
+ else
+ FILES="$FILES,$OUTPUT_FILE"
+ fi
+ COUNT=`expr "$COUNT" + 1`
+done < "$REQUESTFILE"
+
+
addflag GDALWARP c 1
-addflag GDALWARP k ${GIS_FLAG_K}
-addflag GDALWARP p ${GIS_FLAG_P}
+addflag GDALWARP k "$GIS_FLAG_K"
+addflag GDALWARP p "$GIS_FLAG_P"
addargument GDALWARP input "$FILES"
-addargument GDALWARP output "${GIS_OPT_OUTPUT}"
-addargument GDALWARP method "${GIS_OPT_METHOD}"
-addargument GDALWARP s_srs "${GIS_OPT_SRS}"
+addargument GDALWARP output "$GIS_OPT_OUTPUT"
+addargument GDALWARP method "$GIS_OPT_METHOD"
+addargument GDALWARP s_srs "$GIS_OPT_SRS"
# check for error like 'Service Exception Report'
if [ `file -b "$FILES" | grep -c "^HTML\|^XML"` -eq 1 ] ; then
g.message "#################################"
cat "$FILES"
g.message message=""
- \rm -f "${TEMPFILE}"*
+ rm -f "$TEMPFILE"*
exit 1
fi
@@ -579,20 +583,20 @@
r.support map="$GIS_OPT_OUTPUT" history="layers: $GIS_OPT_LAYERS"
if [ -n "$GIS_OPT_STYLES" ] ; then
- r.support map="$GIS_OPT_OUTPUT" history="styles: $GIS_OPT_STYLES"
+ r.support map="$GIS_OPT_OUTPUT" history="styles: $GIS_OPT_STYLES"
fi
r.support map="$GIS_OPT_OUTPUT" history=""
r.support map="$GIS_OPT_OUTPUT" history="Source projection: $GIS_OPT_SRS"
if [ "$GIS_FLAG_P" -eq 1 ] ; then
- r.support map="$GIS_OPT_OUTPUT" history=" (imported without reprojection)"
+ r.support map="$GIS_OPT_OUTPUT" history=" (imported without reprojection)"
fi
r.support map="$GIS_OPT_OUTPUT" description="generated by r.in.wms" history=""
r.support map="$GIS_OPT_OUTPUT" history="$CMDLINE"
-g.message -v message="Map <${GIS_OPT_OUTPUT}> written"
+g.message -v message="Map <$GIS_OPT_OUTPUT> written"
# Clean up:
-\rm -f "${TEMPFILE}"*
+rm -f "$TEMPFILE"*
exit
Modified: grass/branches/releasebranch_6_4/scripts/r.in.wms/wms.download
===================================================================
--- grass/branches/releasebranch_6_4/scripts/r.in.wms/wms.download 2013-05-13 08:47:53 UTC (rev 56230)
+++ grass/branches/releasebranch_6_4/scripts/r.in.wms/wms.download 2013-05-13 09:08:40 UTC (rev 56231)
@@ -58,7 +58,7 @@
fi
if [ "$1" != "@ARGS_PARSED@" ] ; then
- exec g.parser "$0" "$@"
+ exec g.parser "$0" "$@"
fi
g.message -d "[wms.download]"
@@ -91,9 +91,9 @@
#
exitprocedure()
{
- g.message -e 'User break!'
- rm -f "${TEMPFILE}"*
- exit 1
+ g.message -e 'User break!'
+ rm -f "$TEMPFILE"*
+ exit 1
}
trap "exitprocedure" 2 3 15
@@ -106,28 +106,31 @@
# usage: varname "expr"
calculate() {
- g.message message="$2"
- c_tmp=`echo "$2" | $BC $BCARGS`
- eval $1=$c_tmp
+ g.message message="$2"
+ c_tmp=`echo "$2" | $BC $BCARGS`
+ eval $1=$c_tmp
}
################################################################
# Download the tiles!!
GetTiles() {
- g.message "Downloading tiles"
+ g.message "Downloading tiles"
- # init POST-data vs. GET URL method variable
- if [ "$GIS_FLAG_G" -eq 0 ] ; then
- POST_DATA_OK=1
- else
- POST_DATA_OK=0
- fi
+ # init POST-data vs. GET URL method variable
+ if [ "$GIS_FLAG_G" -eq 0 ] ; then
+ POST_DATA_OK=1
+ else
+ POST_DATA_OK=0
+ fi
- CONTENTS=`cat "${REQUESTFILE}"`
+ NUMBER_OF_TILES=0
- NUMBER_OF_TILES=0
- for line in $CONTENTS ; do
+ while read line ; do
g.message -d message="wget command: [$line]" debug=2
+ if [ -z "$line" ] ; then
+ continue
+ fi
+
eval "$line"
emptyness=`file "$OUTPUT_FILE" | grep empty$`
@@ -137,25 +140,25 @@
else
GetData
if [ $? -ne 0 ] ; then
- NUMBER_OF_TILES=`expr $NUMBER_OF_TILES + 1`
+ NUMBER_OF_TILES=`expr $NUMBER_OF_TILES + 1`
fi
fi
- done
+ done < "$REQUESTFILE"
- if [ $NUMBER_OF_TILES -ne 0 ] ; then
- g.message -w "$NUMBER_OF_TILES failed to download"
- return 1
- else
- g.message "All tiles downloaded successfully"
- return 0
- fi
+ if [ "$NUMBER_OF_TILES" -ne 0 ] ; then
+ g.message -w "$NUMBER_OF_TILES tiles failed to download"
+ return 1
+ else
+ g.message "All tiles downloaded successfully"
+ return 0
+ fi
}
##################################
#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
@@ -186,9 +189,9 @@
if [ "$POST_DATA_OK" -eq 0 ] ; then
g.message -v message=""
if [ "$USE_WGET" ] ; then
- wget ${WGET_OPTIONS} "${SERVER}?${STRING}" -O "${OUTPUT_FILE}"
+ wget $WGET_OPTIONS "${SERVER}?${STRING}" -O "$OUTPUT_FILE"
else
- curl ${CURL_OPTIONS} -o "${OUTPUT_FILE}" "${SERVER}?${STRING}"
+ curl $CURL_OPTIONS -o "$OUTPUT_FILE" "${SERVER}?${STRING}"
fi
if [ $? -ne 0 ] ; then
g.message -e "Failed while downloading the data"
@@ -205,13 +208,13 @@
# Initialize variables:
#wget has many options
-WGET_OPTIONS="${GIS_OPT_WGETOPTIONS}"
-CURL_OPTIONS="${GIS_OPT_CURLOPTIONS}"
-REQUESTFILE="${GIS_OPT_REQUESTFILE}"
+WGET_OPTIONS="$GIS_OPT_WGETOPTIONS"
+CURL_OPTIONS="$GIS_OPT_CURLOPTIONS"
+REQUESTFILE="$GIS_OPT_REQUESTFILE"
#Get all the data
GetTiles
# Clean up:
-rm -f "${TEMPFILE}"*
+rm -f "$TEMPFILE"*
Modified: grass/branches/releasebranch_6_4/scripts/r.in.wms/wms.request
===================================================================
--- grass/branches/releasebranch_6_4/scripts/r.in.wms/wms.request 2013-05-13 08:47:53 UTC (rev 56230)
+++ grass/branches/releasebranch_6_4/scripts/r.in.wms/wms.request 2013-05-13 09:08:40 UTC (rev 56231)
@@ -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"
@@ -143,10 +163,10 @@
# usage: message level text
message () {
- if [ $1 -lt $GIS_OPT_V ] ; then
- shift
- echo "$@"
- fi
+ if [ "$1" -lt "$GIS_OPT_V" ] ; then
+ shift
+ echo "$@"
+ fi
}
@@ -159,9 +179,9 @@
# usage: varname "expr"
calculate() {
- message 3 "$2"
- c_tmp=`echo "$2" | $BC $BCARGS`
- eval $1=$c_tmp
+ message 3 "$2"
+ c_tmp=`echo "$2" | "$BC" "$BCARGS"`
+ eval $1=$c_tmp
}
####################################
@@ -173,12 +193,12 @@
#################################################
# ############## TILE SETTINGS ################ #
#################################################
- MAXCOLS=${GIS_OPT_MAXCOLS} #The maximum cols of the biggest tile
- MAXROWS=${GIS_OPT_MAXROWS} #The maximum rows of the biggest tile
+ MAXCOLS="$GIS_OPT_MAXCOLS" #The maximum cols of the biggest tile
+ MAXROWS="$GIS_OPT_MAXROWS" #The maximum rows of the biggest tile
#Calculate the number of tiles and set up the arrays
- message 1 "r.tileset -g sourceproj=\"$PROJ4_SRS\" sourcescale=\"$SRS_SCALE\" overlap=2 maxcols=${MAXCOLS} maxrows=${MAXROWS} $TILESET_OPTIONS"
+ message 1 "r.tileset -g sourceproj=\"$PROJ4_SRS\" sourcescale=\"$SRS_SCALE\" overlap=2 maxcols=$MAXCOLS maxrows=$MAXROWS $TILESET_OPTIONS"
TILES=`eval "GRASS_VERBOSE=1 r.tileset -g sourceproj=\"$PROJ4_SRS\" sourcescale=\"$SRS_SCALE\" overlap=2 maxcols=${MAXCOLS} maxrows=${MAXROWS} $TILESET_OPTIONS"`
if [ $? -ne 0 ] ; then
g.message -e "r.tileset failure"
@@ -188,10 +208,10 @@
NUMBER_OF_TILES=0 #The number of the tiles
#Calculate the number of tiles
for i in $TILES ; do
- NUMBER_OF_TILES=`expr $NUMBER_OF_TILES + 1`
+ NUMBER_OF_TILES=`expr "$NUMBER_OF_TILES" + 1`
done
- g.message "Requesting ${NUMBER_OF_TILES} tiles."
+ g.message "Requesting $NUMBER_OF_TILES tiles."
if [ "$NUMBER_OF_TILES" -gt 200 ] ; then
g.message -w "Proceed with care. This number of tiles may exceed \
the maximum command line argument length available from your \
@@ -202,9 +222,9 @@
NUMBER_OF_TILES=0 #The number of the tiles
- mkdir -p "${GIS_OPT_FOLDER}"
+ mkdir -p "$GIS_OPT_FOLDER"
- FOLDERPLUS="${GIS_OPT_FOLDER}/${GIS_OPT_PREFIX}_${GIS_OPT_REGION}"
+ FOLDERPLUS="$GIS_OPT_FOLDER/${GIS_OPT_PREFIX}_$GIS_OPT_REGION"
if [ $GIS_FLAG_C -eq 1 ] ; then
g.message -v message="Removing files <${FOLDERPLUS}*>"
@@ -212,22 +232,28 @@
fi
if [ -x "`which wget`" ] ; then
- REQUESTFILE="${FOLDERPLUS}.wget"
+ REQUESTFILE="$FOLDERPLUS.wget"
else
- REQUESTFILE="${FOLDERPLUS}.curl"
+ REQUESTFILE="$FOLDERPLUS.curl"
fi
#reset the requestfile
- echo > "${REQUESTFILE}"
+ echo > "$REQUESTFILE"
- echo "$PROJ4_SRS" > "${FOLDERPLUS}.proj4"
+ echo "$PROJ4_SRS" > "$FOLDERPLUS.proj4"
for i in $TILES ; do
eval "$i"
SIZE="bbox=$w,$s,$e,$n&width=$cols&height=$rows"
message 1 "$SIZE"
- IMAGEFILE="${FOLDERPLUS}_${NUMBER_OF_TILES}"
- OUTPUT_FILE="${IMAGEFILE}${FILE_EXTENT}"
+ IMAGEFILE="${FOLDERPLUS}_$NUMBER_OF_TILES"
+
+ 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,19 +271,19 @@
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`
+ NUMBER_OF_TILES=`expr "$NUMBER_OF_TILES" + 1`
done
}
# Initialize variables:
-SERVER="${GIS_OPT_MAPSERVER}"
-SRS="${GIS_OPT_SRS}"
+SERVER="$GIS_OPT_MAPSERVER"
+SRS="$GIS_OPT_SRS"
# use `tr '[:upper:]' '[:lower:]'` instead?
-SRS_lower=`echo $SRS | sed "y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/"`
+SRS_lower=`echo "$SRS" | sed "y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/"`
# If the user asserts that this projection is the same as the source
@@ -279,7 +305,7 @@
SRS_SCALE=1
fi
-WMS_QUERY="${GIS_OPT_WMSQUERY}"
+WMS_QUERY="$GIS_OPT_WMSQUERY"
if [ -z "$GIS_OPT_REGION" ] ; then
TILESET_OPTIONS="$GIS_OPT_TILEOPTIONS"
@@ -287,13 +313,13 @@
TILESET_OPTIONS="region=$GIS_OPT_REGION $GIS_OPT_TILEOPTIONS"
fi
-if [ $GIS_FLAG_O -eq 1 ] ; then
+if [ "$GIS_FLAG_O" -eq 1 ] ; then
TRANSPARENCY="transparent=FALSE"
else
TRANSPARENCY="transparent=TRUE"
fi
-case "${GIS_OPT_FORMAT}" in
+case "$GIS_OPT_FORMAT" in
"geotiff") FORMAT="image/geotiff"
WORLDFILE=".tfw"
FILE_EXTENT=".geotiff"
Modified: grass/branches/releasebranch_6_4/scripts/r.tileset/r.tileset
===================================================================
--- grass/branches/releasebranch_6_4/scripts/r.tileset/r.tileset 2013-05-13 08:47:53 UTC (rev 56230)
+++ grass/branches/releasebranch_6_4/scripts/r.tileset/r.tileset 2013-05-13 09:08:40 UTC (rev 56231)
@@ -126,6 +126,8 @@
exec g.parser "$0" "$@"
fi
+g.message -d "[r.tileset]"
+
# Program locations:
BC="bc"
BCARGS="-l"
@@ -372,14 +374,13 @@
}
### Fetch destination projection and region
+SOURCE_PROJ="$GIS_OPT_SOURCEPROJ"
+SOURCE_SCALE="$GIS_OPT_SOURCESCALE"
-SOURCE_PROJ=$GIS_OPT_SOURCEPROJ
-SOURCE_SCALE=$GIS_OPT_SOURCESCALE
-
# Take into account those extra pixels we'll be a addin'
#MAX_COLS=$GIS_OPT_MAXCOLS
#MAX_ROWS=$GIS_OPT_MAXROWS
-OVERLAP=$GIS_OPT_OVERLAP
+OVERLAP="$GIS_OPT_OVERLAP"
calculate MAX_COLS "$GIS_OPT_MAXCOLS - $OVERLAP"
calculate MAX_ROWS "$GIS_OPT_MAXROWS - $OVERLAP"
More information about the grass-commit
mailing list