[GRASS5] v.in.gpsbabel

Hamish hamish_nospam at yahoo.com
Fri Jan 20 05:17:52 EST 2006

> Hi all, we post the new version of v.in.gpsbabel, with some bug fixed
> ...


Great work. We should put it into CVS so we can work "on the same page"
and make patching easier. Then once all the bugs are sorted out we just
have to activate it.

Uploading routes and tracks works for me. Martin's new 'd.vect -c'
feature is great for viewing each track line in a different color. 
Waypoints don't work at all. Maybe make them use GPX filter instead of 


Please apply recent bug fixes to v.in.garmin:

These are the changes since the version you started from?:

(e.g. unset locale so awk doesn't misinterpret "," as decimal place
holder, add v.in.ascii "EXITCODE=$?" tests etc.)

  output   name for new binary vector file (omit for display to stdout)
    file   device of file used to import data
    proj   projection of input data (use cs2cs options), if not set the
map projection is used

should that be
    file   name of device or file used to import data

I think that option be called "input" not "file"? It is a little
confising as device is not a file. (yes, I know, "in UNIX everything is
a file")

and maybe this is clearer?

    proj   projection of input data (using PROJ.4 terms), if not given
input is assumed to be WGS84 Lat/lon

> g.proj -jf > $TMP.tmp
> read OUT_PROJ < $TMP.tmp

OUT_PROJ="`g.proj -jf`"

shell variables are much quicker and lighter than writing & reading

Import tracks from /dev/ttyS0 garmin GPS in tracks binary vector file 
v.in.gpsbabel -w file=/dev/ttyS0 format=garmin output=tracks 
Should be -t ?

Based on v.in.garmin for GRASS 6.0 by Hamish Bowman"

you should add
"and v.in.garmin.sh for GRASS 5 by Andreas Lange"

as without Andreas's awk programming it wouldn't go anywhere.

The Makefile needs to install grass_write_ascii.style.
gpsbabel -h:
   xcsv                  ? Character Separated Values
     style                 Full path to XCSV style file (required)

add this to the end of the Makefile:
	cp -f grass_write_ascii.style $(GISBASE)/etc/

and in the script:
[gpsbabel ...] -o xcsv,style="$STYLE"

in grass_write_ascii.style:

that doesn't work for me (gpsbabel 1.2.4). It writes out the word 

Need to test for gpsbabel version >= 1.2.?
$ gpsbabel -V | grep Version | cut -f3 -d' '

Seems I need to backport version 1.2.7 of gpsbabel to Debian/stable..

Anyway editing the style file to make it "|" instead of "PIPE" works
for now.

style file:
change %f to %.8f to allow sub-millimeter precision. (we use trimbles :)

next I get:
167.89686441|-44.64901694|-99999999.000000|-99999999.000000|03-DEC-05 02:30
167.91928768|-44.68072065|-99999999.000000|-99999999.000000|03-DEC-05 03:44
Attempting waypoint projection transform with cs2cs
Importing Waypoints...
Maximum input row length: 82
Maximum number of columns: 5
Minimum number of columns: 5
column: 1  type: double
column: 2  type: double
column: 3  type: double
column: 4  type: double
column: 5  type: string  length: 15
ERROR: Number of columns defined (6) does not match number of columns (5)
       in input.

i.e. above input doesn't match columns="":
            cat "${TMP}.asc" | v.in.ascii output="$NAME" cat=0 \
                columns='x double precision, y double precision, altitude double precision, Creatdate varchar(10), time varchar(11), comments varchar(40)'

(note those can just be "columns='x double, y double, ...")

So the style file needs fixing. Style file only defines five columns.
GPX import may go better?

This is what my Garmin 48 reports:

$ gpsbabel -i garmin -f /dev/ttyS0 -o csv -F wpt.csv
-44.64902, 167.89686, 03-DEC-05 02:30
-44.68072, 167.91929, 03-DEC-05 03:44

$ gpsbabel -i garmin -f /dev/ttyS0 -o gpx -F wpt.gpx
<wpt lat="-44.649016941" lon="167.896864414">
  <cmt>03-DEC-05 02:30</cmt>
  <desc>03-DEC-05 02:30</desc>
<wpt lat="-44.680720652" lon="167.919287682">
  <cmt>03-DEC-05 03:44</cmt>
  <desc>03-DEC-05 03:44</desc>

> There is a problem I want to make at your attention: with our gps
> (garmin), when we download points the time-field is not correctly set
> (the time set is not that of point creation but a system default
> time).

start_time of first line gets set to download clock time, not GPS 

end_time is ok.
end_lon is set to first lon value in line, not the last value.

route_id is lost
start_wpt is wrong for all but last route.

> Davide Spano, Claudio Porta 
> University of Pisa
(and Markus)

good on ya,

More information about the grass-dev mailing list