]> git.street.me.uk Git - andy/viking.git/blame - tools/track2route_upload.sh
Example script that can be used to upload a track as a route to a predefined GPS...
[andy/viking.git] / tools / track2route_upload.sh
CommitLineData
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#
9if [ -z "$1" ]; then
10 echo "Need a file to process"
11 exit 1
12fi
13
14if [ ! -e "$1" ]; then
15 echo "Specified file >$1< does not exist"
16 exit 1
17fi
18
19# Delete lines with track segments - there is no equivalent in routes
20# Then simply replace track and trackpoints with route types
21
22sed -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
31gpsbabel -r -i gpx,gpxver=1.1 -f "$1" -o garmin -F /dev/ttyUSB0
32# One may need to change this for your configuration
33