[GRASS-user] How to export 3D vector elevations with v.out.gpsbabel

Dwight Needels needels at translucida.com
Sat Mar 6 19:22:59 EST 2010

Hi all,

The v.out.gpsbabel module is wonderful. I particularly like the way to  
automatically reprojects data into Lat/LonWGS84.

I have been importing multiple GPS tracks (of hiking trails) into  
GRASS for "averaging", then using v.out.gpsbabel to export a .gpx  
track format for use on my GPS. I recently used v.drape to pull  
elevations from a DEM into the vector, and had hoped that using  
v.out.gpsbabel to export the resulting 3D vector would automatically  
export the elevation into the standard "ele" GPX data field.  
Unfortunately, the elevations all exported as 0.

Am I missing an option to have v.out.gpsbabel do this automatically?  
If not, this would be a nice enhancement.

If not, is there a workaround I can use?

The v.out.gpsbabel manual indicates that an attribute field named  
"ele" would be exported as elevation, but I can't quite figure out how  
to get the elevation from wherever it is stored in a 3D vector  
(associated with vertex geometry?) into an attribute table and from  
there into an exported track.

Since the exported track needs an elevation associated with each track  
point (rather than line), I created a points vector using v.to.points - 
v, added an "ele" column to layer 2 (the layer with cats for the  
points), and then used v.what.rast to pull elevation values from a DEM  
into the "ele" column.

Unfortunately, when I tried to use v.out.gpsbabel layer=2 -w to export  
to waypoints (or -t to export to tracks) it fails with the following  
    /Applications/GRASS-6.4.app/Contents/MacOS/scripts/m.proj: line  
197: [: : integer expression expected
    ERROR: Error reading categories: [ -76.28746517 39.40506425  
    ERROR: Error reprojecting data

By the way, the first line (m.proj: line 197:[: : integer expression  
expected) occurs every time I use v.out.gpsbabel, even when it  
successfully exports a .gpx file.

Any ideas what is going on here? Other ways to 3D vector elevations  
exported into a .gpx track file?

I am running William Kyngesburye's 6.4RC5-3 on Mac OS X Leopard.

Thanks, -Dwight

More information about the grass-user mailing list