[GRASS-SVN] r31835 - grass/branches/develbranch_6/scripts/v.in.gpsbabel

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Jun 24 07:36:29 EDT 2008


Author: hamish
Date: 2008-06-24 07:36:29 -0400 (Tue, 24 Jun 2008)
New Revision: 31835

Modified:
   grass/branches/develbranch_6/scripts/v.in.gpsbabel/v.in.gpsbabel
Log:
if altitude data is missing replace it with a 0 as v.in.ascii defined column type is expecting doubles

Modified: grass/branches/develbranch_6/scripts/v.in.gpsbabel/v.in.gpsbabel
===================================================================
--- grass/branches/develbranch_6/scripts/v.in.gpsbabel/v.in.gpsbabel	2008-06-24 09:49:22 UTC (rev 31834)
+++ grass/branches/develbranch_6/scripts/v.in.gpsbabel/v.in.gpsbabel	2008-06-24 11:36:29 UTC (rev 31835)
@@ -296,10 +296,11 @@
 
     cat "${TMP}.xcsv" | cut -f 1,2 -d '|'| tr '|' ' '  > "$TMP".base
 # FIXME: if last field (comments) is empty it causes a not-enough fields error in v.in.ascii
-
+# FIXME: if altitude column is empty (1st attr) v.in.ascii complains as the column type is defined as 'double'
     cat "${TMP}.xcsv" | tr '+' '|' | cut -f3,4,5,6 -d '|' | \
 	sed -e 's/-99999999.000000//' -e 's/|$/|_/' \
-	    -e 's/01\/01\/1970|00:00:00 AM/|/' > "$TMP".attributes
+	    -e 's/01\/01\/1970|00:00:00 AM/|/' \
+	    -e 's/^|/|/'> "$TMP".attributes
 
 
     #### reproject if needed
@@ -344,14 +345,14 @@
 	    g.message "Importing Tracks as points..."
 	fi
 
-	cat "${TMP}.asc" | v.in.ascii output="$NAME" cat=0 \
+	v.in.ascii in="${TMP}.asc" output="$NAME" cat=0 \
 	  columns='x double precision, y double precision, altitude double precision, gmt_date varchar(10), gmt_time varchar(11), comments varchar(40)'
 	EXITCODE=$?
 
 	# EXITCODE also used at pgm termination below!
 	if [ $EXITCODE -ne 0 ] ; then
 	    g.message -e "While Importing data with v.in.ascii"
-	    rm -f "${TMP}."*
+	    rm -f "${TMP}"*
 	    exit 1
 	fi
     fi



More information about the grass-commit mailing list