[GRASS-SVN] r57800 - grass/branches/releasebranch_6_4/scripts/v.in.garmin

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Sep 22 01:52:19 PDT 2013


Author: hamish
Date: 2013-09-22 01:52:18 -0700 (Sun, 22 Sep 2013)
New Revision: 57800

Modified:
   grass/branches/releasebranch_6_4/scripts/v.in.garmin/v.in.garmin
Log:
improved support for spaces in path names (specifically the cs2cs NTv2 grid file), merge from devbr6

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-09-22 08:48:19 UTC (rev 57799)
+++ grass/branches/releasebranch_6_4/scripts/v.in.garmin/v.in.garmin	2013-09-22 08:52:18 UTC (rev 57800)
@@ -256,7 +256,15 @@
 
 #### set up projection info
 IN_PROJ="+proj=longlat +datum=WGS84"
-OUT_PROJ="`g.proj -jf`"
+
+OUT_PROJ=`g.proj -j | (
+    OUT_PROJ=
+    while read line ; do
+	OUT_PROJ="$OUT_PROJ '$line'"
+    done
+    echo "$OUT_PROJ"
+)`
+
 PROJ_TYPE=`g.region -p | grep 'projection' | cut -f2 -d" "`
 if [ $PROJ_TYPE -eq 0 ] && [ $KEEP_WGS84 -ne 1 ] ; then
     g.message -e "Cannot project to a XY location."
@@ -463,7 +471,8 @@
 	cp "${TEMPFILE}.base" "${TEMPFILE}.P_base"
     else
 	g.message "Attempting waypoint projection transform with cs2cs..."
-	cs2cs -f %.7f $IN_PROJ +to $OUT_PROJ < "${TEMPFILE}.base" > "${TEMPFILE}.P_base"
+	eval cs2cs -f %.7f $IN_PROJ +to `echo $OUT_PROJ` \
+	   < "${TEMPFILE}.base" > "${TEMPFILE}.P_base"
 	EXITCODE=$?
 	# check if transform REALLY worked (e.g. grid file not found)
 	BAD_PTS="`grep -c "^\*" "${TEMPFILE}.P_base"`"
@@ -671,7 +680,8 @@
 	    $1!="L" { printf(" %.7f %.7f\n", $1, $2) } END {;}' > "${TEMPFILE}.P_base"
     else
 	g.message "Attempting waypoint projection transform with cs2cs..."
-	cs2cs -tL -f %.7f $IN_PROJ +to $OUT_PROJ < "${TEMPFILE}.base" > "${TEMPFILE}.P_mid"
+	eval cs2cs -tL -f %.7f $IN_PROJ +to `echo $OUT_PROJ` \
+	   < "${TEMPFILE}.base" > "${TEMPFILE}.P_mid"
 	EXITCODE=$?
 	# check if transform REALLY worked (e.g. grid file not found)
 	BAD_PTS="`grep -c "^\*" "${TEMPFILE}.P_mid"`"



More information about the grass-commit mailing list