[GRASS-dev] v.in.gpsbabel nearly fixed: awk magic needed (RT bug #5478)

Hamish hamish_nospam at yahoo.com
Thu May 10 23:39:18 EDT 2007

Markus Neteler wrote:
> I think I got v.in.gpsbabel for tracks and routes (did that
> ever work?). However, I have a final problem which requires
> a bit of awk magic:
> The GPX tracks file extracted from my Garmin contains a track
> which isn't attributed (I dunno why but that's life). The
> v.in.gpsbabel scripts successfully creates the map, then fails
> on creating the attrib table. Here the problem:
> # note: files contains tab delimiters
> head -2 12021.0.track_atts
> 1
> 2               45.417394638    10.847196579            45.359029770    10.166580677
> # make tab delim visible (just for illustration):
> head -2 12021.0.track_atts | tr -s '\t' '|'
> 1 | | | | | |
> 2 | |45.417394638 |10.847196579 | |45.359029770 |10.166580677

I see you too have figured out that ,style="$STYLE" wasn't needed for
gpx format. I was just about to commit that! ;)

I think the extra ,style= only triggerd a harmless warning, which is why
we didn't pick it up before. If gpsbabel has an exit code of 1 the
script should quit right there, but in the bug report it continues on. 

> # make tab delim visible (just for illustration):
> head -2 12021.0.track_atts | tr -s '\t' '|'
> 1 | | | | | |
> 2 | |45.417394638 |10.847196579 | |45.359029770 |10.166580677

this MAY may may be related to some change I May have made to work
around an off-by-one bug I was struggling with. It turns out that there
is a bug in the Garmin 45,48,12XL firmware* where if the track fills
memory and loops the timestamp record can be shifted by one spot vs.
x,y,z record. Before I figured that out I was having all sorts of
trouble getting v.in.gpsbabel and v.in.garmin to produce the same
output- always atts off by one! I had asked Davide and Claudio to fix
this bug in their script before submission, but they never could! oops.

[*] reported to Garmin, but I never heard back from them

I will request one of our field GPSs back here for more testing.

summary: compare track and timestamps vs GPX download file, I suspect
the track_atts are shifted down one line, and worrying about sed -e
's/| |/|NULL|/' only masks the real bug.


More information about the grass-dev mailing list