Convert Google Map Routes to Garmin GPX Files

IMPORTANT

Update 11/08/2012: The new version is now live at this address. This page is simply being kept as an archive (most of the links probably won't work.

Update 09/08/2012: I now have a proof-of-concept up and running, so I can confidently say that I will have a working GPX generator very soon. I'm trying to add a bit of polish to the application (I've never done any real web development before, so there's quite a learning curve here), but hopefully it won't take too long. Unless I find a work-around, however, the new version won't be able to create routes from Google Maps URLs: you'll have to use a copy of Google Maps that will be embedded in the web page to create the route (it will still support dragging of routes to customise the route). Hopefully this won't cause too many problems (and if I can find a way round it I will), but if there's anyone who particularly needs to convert existing Google Maps URLs, please get in touch and I'll let you know as soon as I've found a way of doing this.

Update 29/07/2012: I've found a plausible work-around for this issue. However, it's going to involve re-writing a lot of the code (and learning javascript programming!), so it could take me a couple of weeks. I'll try to get this up and running again as soon as I can.

Update 27/07/2012: it seems Google have just changed the maps page on their website so that it no longer allows the routes to be extracted via KML (the method used by this script). See here for one online mention of this. This means that my converter is currently not working, but I am currently looking into possible work-arounds and will update this page as soon as I have any news. Sorry if this causes problems for anyone and thanks to George R. Primavera for reporting the issue.

Introduction

The Garmin GPS units are excellent for navigation, but if you want to plan a custom route, the process can be quite laborious. There are a number of sites on the web that will convert Google Maps to generic GPX files. However, these are based on 'proper' GPX files and involve having a separate waypoint wherever the route needs to be fixed. If you're travelling along and find a road closure, it becomes very difficult to bypass a section of the route and then rejoin your route at a later point (it will keep redirecting you to the point you missed).

Garmin have recently released a software update (for the Zumo 660 at least) that prevents the GPS from recalculating a route when it is imported. With this update, it is possible to plan a route on Google Maps and import it into the GPS as a GPX file with Garmin extensions. You can then follow the route as normal. If you need to deviate from the route, it will then recalculate the whole route (and lose your customisations). However, if you (manually) find your way back onto some part of the route and re-start navigation along the custom route, it will carry on from where you are and you can continue to use your customised route. There's also an option buried in the settings that makes the Garmin prompt before recalculating a route, so you can click 'No' and get back onto the route in your own time.

This utility is free and always will be. If you find it useful, please consider sending me a message to let me know.

Does my Garmin Support This?

To find out if your Garmin supports this feature, find the Change History for your device (for example, the Zumo 660 change history is here). The relevant entry for the Zumo 660 is:

Corrected to allowed [sic] routes to be imported from matching maps on MapSource without recalculation.

In the case of the Zumo 660, this was implemented in software version 3.80. Therefore, if you have this version or greater, your device already supports this. If not, you'll need to use WebUpdater to get the latest version.

If you can't find anything sounding relevant in the Change History for your device, then it's likely that you won't be able to use this and I'd recommend sticking with the other type of converter.

How Do I Use It?

First, go to Google Maps and plan your route. Due to a limitation on the Google Earth exporter from Google Maps (which I use to generate the GPX file), there can only be two end points on your route (i.e. a start and an end but no intermediate destinations). As far as I can tell, there is no limit (beyond the limits that Google Maps imposes) on the number of 'control points' (the little white dots you get from dragging the route onto the roads you want to use. Below is an example of a fantastic biking route; on the left the route is shown with an intermediate destination (which won't work) and on the right is the same route without an intermediate destination (which will). The route is also available at this tinyurl link or this long link.

Click the images to see bigger versions.

Bad Route Good Route

Once you've planned your route, click on the little link icon in the top right hand corner of the page. That should present you with a (rather long) URL that describes your route. You might want to paste it into a new browser tab just to check that it has worked. Either take that URL or a shortened version of it (with e.g. TinyURL, bitly or the Google URL Shortener) and paste it into the form below (a simple form is also available at http://gpx.cgtk.co.uk). Give the route a short name to show in the list of routes click "Convert to GPX". You'll then be offered a new GPX file, which you can import into your Garmin in the usual way.

Route Name:
Google Maps URL:

How Does It Work?

The tool relies on the Google Earth exporter from Google Maps. If you take any Google Maps URL and append &output=kml onto the end, it will give you a Google Earth KML file describing the route (up to the first stopping point, as described above). My script reads this KML and produces a Garmin-format GPX file based on its contents. To make debugging the code a bit easier, I generate the GPX file in a relatively human-readable format (on lots of cleanly indented lines rather than all on one), but that shouldn't make any difference to the operation of the script. The (python) source code of the converter itself is here (licensed under the GPL) in case you want to use it without access to the website (but presumably with access to Google Maps). If you find this tool useful, please do let me know (using the contact form).


What about non-Garmin devices?

This tool was designed specifically to work with Garmin devices: it's designed to provide a route that the Garmin will follow, but allow you to deviate from without having to back to every intermediate point simply because there's a minor road blockage that you have to bypass. Nevertheless, the process of converting a route into a 'normal' GPX file is virtually identical to the one for Garmin GPX files, so this is also possible with my tool. To keep this website simple, I've left the option to generate a normal GPX file off the form, but if you go to http://gpx.cgtk.co.uk, you'll see an option to produce a standard GPX file. Be warned, however, that the Garmin GPX format is designed to cope with the large numbers of intermediate points that track a route out precisely. Even the simple route shown above produces over 1100 intermediate points. A 'normal' GPX file will have each of these as a 'stopping' point and this will probably cause problems with your GPS. Other tools for generating normal GPX files (such as this one) work in a different way and are almost certainly more suitable for generating that type of file.