Ticket #905: gpx2navitrouteguardtxt.sh

File gpx2navitrouteguardtxt.sh, 535 bytes (added by tegzed, 10 years ago)

simple script to create navit textfile map from a gpx track to use with route_guard osd

Line 
1#!/bin/bash
2
3if [ $# -ne 3 ]
4then
5        echo "usage:"
6        echo "$0 [inputfile] [outputfile] [simplify_count]"
7exit
8fi
9
10outfilename=$2
11infilename=$1
12simplify_count=$3
13
14tmpfile=`tempfile`
15tmpfile2=`tempfile`
16
17echo 'type=track name="route_guard_test"' > $outfilename
18
19gpsbabel -i gpx -f  $infilename -x simplify,count=$simplify_count -o gpx  -F $tmpfile
20
21gpsbabel -t  -i gpx -f  $tmpfile  -o unicsv -F $tmpfile2
22
23cut -f 2,3 -d, $tmpfile2 | sed -e 's/,/ /' | grep -vi longitude |awk '{print $2 " " $1}' >>$outfilename
24
25rm -f $tmpfile $tmpfile2
26