Skip to content

Instantly share code, notes, and snippets.

@josuecau
Last active March 8, 2021 20:15
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save josuecau/fb0b049ca4a58fda409286a353e805d9 to your computer and use it in GitHub Desktop.
Save josuecau/fb0b049ca4a58fda409286a353e805d9 to your computer and use it in GitHub Desktop.
Convert GPX routes (rte) into tracks (trk) using gpsbabel (https://www.gpsbabel.org)
#!/usr/bin/env bash
#
# Convert GPX routes (rte) into tracks (trk) using gpsbabel.
# (https://www.gpsbabel.org/)
set -e
if ! type gpsbabel >/dev/null 2>&1; then
echo 'gpsbabel not found'
exit 1
fi
if [ $# -ne 2 ]
then
echo "Usage: $(basename "$0") <input.gpx> <output.gpx>"
exit 1
fi
gpsbabel -i gpx -f "$1" -x transform,trk=rte,del -o gpx -F "$2"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment