Saturday 19 June 2010

How to create courses for your Garmin

This is more of an aid-memoire for me, but if it helps you....


Purely Web based OS Agnostic method
  1. Go to gmaptogpx and follow the instructions to create a bookmark.
  2. Draw your route in Google Maps. Other mapping software exists.I find using the walking option gives more sensible routes for cycling.
  3. Click on the gmaptogpx as installed above. This will show you a gpx file. Copy this into a file called .gpx
  4. Now go to gpsies. Select the .gpx file created above, and select as an output a .crs file. Save the .crs
  5. Connect your Garmin device to the computer and copy the .crs file into the directory "New Files"
  6. Safely remove the device and restart it. The Garmin will import the course ready for use.

If you want software to download to help
As an addendum, I've also used the following, if you're on a Windows machine, this replaces 4 above
The advantages are that you can set the average speed (the Google Maps average speed for walking isn't much use for cycling if you want to do comparative routing. If you use the driving option then you'll be sadly lagging behind!)


  1. Create your GPX file (see 1-3 above)
  2. Download Gpx2Crs as a zipfile
  3. Unzip
  4. Select the "Convert GPX to Course" tab
  5. Select the average speed you wish to do your route at
  6. Fiddle with the other buttons if you want
  7. Go to 5-6 above
Addendum
I've used gmaptogpx. There's now gmap2tcx available here
http://code.google.com/p/gmap2tcx/

As yet untested but it should avoid the gpx to .crs conversion in gpsies above.

If GMapToGpx doesn't work it may suggest downloading as a  KML file and converting using http://www.gpsvisualizer.com/

Editing kml/gpx

if you want to edit your kml/gpx, you can't. What you can do is use http://www.gpsvisualizer.com/ to convert to a text file. Then a bit of python to generate a file in the format
From, <(less than 25 *to,>

This can be pasted into the google maps search window and a basic route can now be edited.

Caveat: I'm not a python expert. Here's something I bodged in an hour
# Format of data is
#T:

#Output format is
#From:,to:,>
#Keep first and last lines, delete 1 in n lines, where n programmable, should leave around 25 entries.
import sys, optparse

def write (where, what):
    print what
    where.write (what)

def main (options, args):
    image = open(options.image, "r").readlines()
    print "len %d name %s" % (len(image), options.image)
    name = "output_" + options.image
    output = open (name, "w")
    image.pop(0)
    start = (image.pop(0)).split('\t')
    write (output, "from:%s,%s " % (start[1], start[2]))
    end = (image.pop()).split('\t')
    count = 0
    modulus = 1 + len(image) / 22
    #print "Modulus: ", modulus
    for a in image:
        a = a.rstrip ()
        #print "len %d string %s" % (len(image), a)
        b = a.split('\t')
        #print b
        if not (count % modulus):
               #print "Count %d mod %d res %d " % (count, modulus, count % modulus)
               write (output, "to:%s,%s " % (b[1], b[2]))
        count += 1
       
    write (output, "to:%s,%s " % (end[1], end[2]))
    write (output, "to:%s,%s " % (start[1], start[2]))
       

if __name__ == '__main__':
    option_parser = optparse.OptionParser()
    option_parser.add_option('-n', '--num', dest='num', help='skip n', default=10, type="int")
    option_parser.add_option('-i', '--image', dest='image', help=' image', default='./file.txt')
    options, args = option_parser.parse_args(sys.argv[1:])

    main (options, args)



A little bit of python can convert a KML or GPX fi