]>
Commit | Line | Data |
---|---|---|
2f66b822 RN |
1 | #!/bin/sh |
2 | ||
3 | # Quick script to convert the given file and upload load it to an attached GPS device | |
4 | # As this modifies the given file, it is ideally designed for temporary files. | |
5 | ||
6 | # | |
7 | # Some basic checks | |
8 | # | |
9 | if [ -z "$1" ]; then | |
10 | echo "Need a file to process" | |
11 | exit 1 | |
12 | fi | |
13 | ||
14 | if [ ! -e "$1" ]; then | |
15 | echo "Specified file >$1< does not exist" | |
16 | exit 1 | |
17 | fi | |
18 | ||
19 | # Delete lines with track segments - there is no equivalent in routes | |
20 | # Then simply replace track and trackpoints with route types | |
21 | ||
22 | sed -i \ | |
23 | -e '/trkseg/d' \ | |
24 | -e 's:<trkpt:<rtept:g' \ | |
25 | -e 's:</trkpt>:</rtept>:g' \ | |
26 | -e 's:<trk>:<rte>:g' \ | |
27 | -e 's:</trk>:</rte>:g' \ | |
28 | "$1" | |
29 | ||
30 | # Ths is obviously setup for a USB Garmin device | |
31 | gpsbabel -r -i gpx,gpxver=1.1 -f "$1" -o garmin -F /dev/ttyUSB0 | |
32 | # One may need to change this for your configuration | |
33 |