Family, Work, Life

Bikemap Routes on Garmin GPS

June 13th, 2009 Ansi

Moin

I love Peters Bikemap.net page. Using this service to plan all my bike tours. Unfortunately my Garmin (GPSmap 60) does not understand the gpx file from Bikemap export. I wrote this little script to modify and split the route into smaller routes. GPSmap 60 only handle 250 points per route. Therefore the script splits the route into smaller pieces, renames the note names into “rtept” resp. “rte” and uploads the route via USB to the connected garmin.

What you need to run this script are gpsbabel and the unix commands: sed, split,cut and head .

Here it is, as usually no guarantee.

#!/bin/bash
filename=$1

gpsbabel -i gpx -f ${filename} -o csv -F out.csv
split -l 200 out.csv splits
rm out.csv

for i in `ls splits*`
do
 gpsbabel -i csv -f ${i} -o gpx -F ${i}.gpx
 sed 's/wpt/rtept/' ${i}.gpx > out
 rm ${i}.gpx
 mv out ${i}.gpx
 rm ${i}

 linenumber=`wc -l ${i}.gpx | cut -d " " -f 1`
 let linenumber-=1

 sed -n 10,${linenumber}p ${i}.gpx >a.gpx

 rm ${i}.gpx

 cat ${filename} | head -n 9  >${i}.gpx
 echo "<rte>"                >>${i}.gpx
 cat a.gpx                   >>${i}.gpx
 echo "</rte>"               >>${i}.gpx
 echo "</gpx>"               >>${i}.gpx
 rm a.gpx

 sudo gpsbabel -r -i gpx -f ${i}.gpx -o garmin -F usb:0
 rm ${i}.gpx
done
  • Share/Bookmark

Using Garmin with linux and gpsbabel

August 19th, 2008 Ansi

This post if more for myself then for others because you can find this information on many places. I bought a Garmin GPS Map 60 some time ago. It works great with Linux and the GPSBabel software. In order to transfer the loc files from the Geocaching.com side you can use this script:

#!/bin/bash
rm a.csv
rm a.kml
rm a.gpx
for i in *.loc
do
gpsbabel -i geo -f $i -o csv,prefer_shortnames -F $i.csv
cat  $i.csv >> a.csv
rm  $i.csv
done
gpsbabel -i csv -f a.csv -o kml -F a.kml
gpsbabel -i csv -f a.csv -o gpx -F a.gpx

sudo gpsbabel -i gpx -f a.gpx -o garmin -F usb:0
sudo gpsbabel -i garmin,power_off -f usb:0

This script converts all the *.loc files in one folder into one GPX and one KML file. the KML file can be placed on a webserver and then fiewed with google maps or via google earth. Here are some usefull commands:

Upload route:

sudo gpsbabel -r -i garmin -f usb:0 -o kml -F u.kml

Tracks downloaden from Garmin:

sudo gpsbabel -t -i garmin -f usb:0 -o gpx -F tracks.gpx

Switch the Garmin off:sudo gpsbabel -i garmin,power_off -f usb:0

Best Webpage I found for creating routes for bike tours is Marengo

And now have fun. :-)

  • Share/Bookmark