Просмотр исходного кода

if altitude data is missing replace it with a 0 as v.in.ascii defined column type is expecting doubles (merge from devbr6)

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@31836 15284696-431f-4ddb-bdfa-cd5b030d7da7
Hamish Bowman 17 лет назад
Родитель
Сommit
1547fc1015
1 измененных файлов с 4 добавлено и 3 удалено
  1. 4 3
      scripts/v.in.gpsbabel/v.in.gpsbabel

+ 4 - 3
scripts/v.in.gpsbabel/v.in.gpsbabel

@@ -296,10 +296,11 @@ if [ $CREATE_POINTS -eq 1 ] ; then
 
     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,7 +345,7 @@ if [ $CREATE_POINTS -eq 1 ] ; then
 	    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=$?