-
-
Save NickCharsley/fe03e63985823667c48b to your computer and use it in GitHub Desktop.
Revisions
-
hrpunio created this gist
Jul 24, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,41 @@ #!/bin/bash # Convert TCX (Garmin Edge) to GPX with gpsbabel # Usage: tcx2gpx tcx-file-name [-o gpx-file-name] -max 999 # -o -- gpx-file-name, if not given, computed from tcx-file-name (it is assumed YYYY-MM-DD*.tcx) # -max -- produce simplified track with maximum 999 trkpoints # SIMPLIFY="" if [ $# -eq 0 ]; then echo "*** tcx2gpx tcx-file -o [gpx-file] -max 999 ***"; echo "*** If gpx-file is not given script assumes that tcx-file is as YYYY-MM-DD*.tcx ***" echo "*** and constructs gpx-file name as YYYY-MM-DD.gpx ***" exit 1; fi while test $# -gt 0; do case "$1" in -max) shift; COUNT="$1";; -max*) COUNT="`echo :$1 | sed 's/^:-max//'`";; -o) shift; OUT="$1";; -o*) OUT="`echo :$1 | sed 's/^:-o//'`";; *) FILE="$1";; esac shift done if [ -z "$OUT" ] ; then gpxfile=`echo $FILE | cut -b 1-4,6-7,9-10`.gpx; else gpxfile="$OUT" fi if [ "$COUNT" != "" ] ; then SIMPLIFY="-x simplify,count=$COUNT" ; fi if [ -e "$gpxfile" ] ; then echo "FILE $gpxfile exists! REMOVE IT MANUALLY" else gpsbabel -i gtrnctr -f $FILE $SIMPLIFY -o gpx -F $gpxfile fi