Converting Google Maps' Directions
into
Turn by Turn GPS Route/Waypoint Files

© Beverly Howard, Austin, Tx, 2006

8/20/2014 Notes

The GMap2GPX bookmarklet stopped working over a year ago as browsers began to implement new security restrictions including some commands in the "bookmarklet" referenced in this article.  As of this date, neither of the two bookmarklet versions work in current versions of FireFox, IE and other top browsers although it does work when older versions are used... for example, it works in FireFox version 12

Yesterday, it was discovered that the new conversion bookmarklet works in the browser "Pale Moon"  (The Pale Moon web browser is based on Mozilla and is functionally identical to FireFox)  At the time of this writing, this is the ONLY current web browser that the bookmarklet is known to work in.

Google has also released a "New Maps" version as it's primary web mapping software. Fortunately google still offers the option to use "Classic Maps" which this bookmarklet requires to generate the GPX waypoint route files described below... Make sure you are using that "Classic Maps" interface before using the bookmarklet or you will waste a lot of time.


It has been a blast to sleuth out the following information out and accomplish usable "Turn by Turn" navigation capabilities on any relatively simple GPS which has uploadable Waypoint/Route capabilities.

Every day I continue to be amazed at the capabilities of my "Basic" Magellan Meridian GPS Unit and the following process promises to add an entirely new dimension to it's value as a navigation aid without the need for special "Turn by Turn Routing Software"on the device itself.

In fact, the following process does not need to make use of any software on my computer other than using my default Internet Browser... everything can be accomplished using free web resources although I have found that using the PC based GPSUtility to be a much more efficient way to massage and convert the GPX output to work on my GPS unit.

Also, while I have MapSend maps on my GPS, a "route" file does not even require maps as the turnpoints will be accurately displayed relative to the current location of the GPS to give a "heads up" as the remaining distance to each point diminishes as you approach each turn.

The main resources to accomplish this are;


1/13/07... the missing piece necessary to build variable routes has just been added to google maps. Click Here for details!
(Note as of 3/16/07 the conversion of routes containing "additional destinations" appears to have stopped working)

What follows is a step by step tutorial on generating an SD Card Waypoint/Route file which can be copied directly to any SD memory card and then loaded from the card into a Meridian GPS unit.

The Following also works to generate waypoint files for Google Map Location Search Results...


Setting Up a Google Map to GPX Toolbar Link

This is the only tricky part of the process... the following link is not a location, but, rather, a Javascript command which references the Elsewhere.Org site's converter tool.  The need is to put this link on your browser's "personal toolbar" so that it will be accessible when the Google Maps directions and Route Map are displayed.

If you are using Mozilla/FireFox, it's dead simple... grab the following link and drag it to your personal toolbar at the top of your browser page.

GMap2GPX2

The above link command is complex and contains a <space> so, the drag and drop method is the easiest way to get it to the toolbar... if you are curious, the command follows and must be on a single line including the <space> and <semicolons>

javascript:(function(){var%20script=document.createElement('script');
script.src='//raw.github.com/rjl20/gmaptogpx/master/gmaptogpx.js';
document.getElementsByTagName('head')[0].appendChild(script);})()

For those of you using IE, it's not quite that simple.  There are additional steps to get the link onto the IE toolbar

Right click GMap2GPX2 and select "Add to Favorites"

Select the "Links" folder... this puts the GM2GPX link in the "Links" bar to the right of the ie address bar.

The good news is that above only needs to be done once.

Technical note;

There have been two different versions of this bookmarklet since it was created.

The first version (
elsewhere.org) was replaced with a new version (github.com) in 2013 written to deal with the security changes implemented by most current browsers.  With the rapid changes in browser security since, the new version began to fail with these versions and does not work with current browsers at the time of this writing.  As mentioned above, the new version (above) does work with the "Pale Moon"  web browser.

The code contained in the original bookmarklet contains;
javascript:(function(){var cript=document.createElement('script');
script.src='http://www.elsewhere.org/GMapToGPX/gmaptogpx.js';
document.getElementsByTagName('head')[0].appendChild(script);})()





Following setting up the bookmarklet in your browser, the first step to obtain a waypoint file is to enter both a "from" and "to" address into Maps.Google.com

Go to http://Maps.Google.com, click the "Get Directions" tab, enter the addresses, then click the "Get Directions" button.



Google Maps will generate both a map and a list of each turn along the route from beginning to end.

Note that the above link, the resulting map and directions are all now visible in the same window.



As of Jan 13, 07, Google added the ability to include multiple "stops" to it's direction, so it's now possible to exercise control over building routes.

I's not actually "stops" but "additional destinations" so, you build a route to the first "stop" then add destinations to extend the route to additional stops and a final destination.  To see this, run a "Get Directions" between your Start point and the first "Stop"  When the directions render, go to the end of the directions list and click "Add Destination"  You can simply add a city. state name as a specific address is not necessary.
The additional

The directions generated by these destinations will be included in the GMapToGPX output when it is run.  It's not even necessary to have the full directions showing as in the first example... the converter will pull all of the direction turns from just a list of multiple destinations.

The above example  also shows a clear example of why having the ability to control a route is important.  It's obvious to almost anyone that it's shorter and quicker to continue on highway 290 from south of Johnson City to Austin, but the computer has a strong need to follow the major roads which ends up in it's choosing the longer route via highway 71, so, adding Dripping Springs as a destination after Johnson City would meet that need.

What happens if google takes a route you don't agree with?  Simply click the <Back> button and add an interum destination.


Time to generate a Route/Waypoint file from those directions... which, it turns out, can be gleaned from Google page.

Click the GM2GPX link bookmark on the toolbar and you will be taken to a GPX output file page which contains waypoints for all of the route turnpoints.

A "Route" output file is the default action of the GM2GPX link command... after you click the toolbar bookmark, the following screen will appear containing a full GPX "Route" file...

(Note! For IE users, you will have to first click on the google "Link to this page" ...at the upper right of the directions map.)

For starters, stick with the default "Route" format to simplify things and prevent problems and confusion.
 


 

Note that the first button says "Track!"  Clicking that button will convert the file to a "Track" and the other buttons offer more options... in fact the "Full" button will generate a complete "breadcrumb" back track file but will be many, many times larger than the "Route" turnpoint file which should be sufficient and much easier to follow for normal point to point navigation, but, for the beginning, I suggest sticking with the default "Route" GPX output.


OK, now there's a "manual" step required here.... first, click somewhere in the "whitespace" containing the resulting GPX directions, <Ctrl-A> to "select all" <Ctrl-C> to "copy," then open NotePad or another plain text editor, <Ctrl-P> to "paste" it into a new file, then save the file.... in this case named "SAPhoto.gpx"  (What you copied should begin with <?xml...)

(Note... before saving the file is the best time to edit the waypoint names and comments... see below)


At this juncture, I'll point out that there are a number of different options on using or processing the GPX file that has just been generated.  You can use any of many "converter utilities" which will convert GPX files into formats used by most GPS units which allow waypoint and route imports.  In fact, some GPS units will be able to use the above GPX file without any conversion and the converter utility may be able to load the route file directly into a connected gps as part of the conversion process.
 
 

A few of the many utilities available include GPSBabel, GPSUtility and GPSVisualizer.  The following steps use GPSVisualizer since it is a web based conversion utility and does not require any special software to be installed on a computer and can be used with most computer os'.

The first two are PC based and the third is a web based implimentation of GPSBabel.  After a couple of months of use, I have found that GPSUtility is the simplest when you edit the waypoint names and tags.  GPSVisualizer allows you to complete the transformation without needing a pc with gps software installed such as when traveling and using an unfamiliar computer.

Alan Murphy added the ability to directly paste the copied GPX output directly into GPSUtility which eliminates several steps and the time necessary to generate and manipulate import files.

The GPSUtility interface allows quick and easy manipulation of each line of code using a single dialogue box containing all of the info for each waypoint in the route... plus, at the bottom of the box (marked with a red arrow) is a scroll button which allows instant scrolling from line to line.

Editing the Names and Comments

The generated GPX Route/Waypoint file contains "generic" turnpoint names such as "Turn X" plus the Google intersection comments, if the trip is long and complex, take the time to edit the turnpoint names to make them shorter and clearer... for example, Changing "Turn 1" to "MyStreet" and the comment from "Head northeast from My Street St" to "NWfromMyStreet" so that they are easier to read and understand on a  small GPS screen.  Finally, I have gotten in the habit of putting the exact address and telephone number (if available) of the route destination in the comments of the last entry ...it's come in very handy several times.

Note that different devices and applications may have length restrictions for waypoint and other field names.  The Meridian GPS unit is not only restricted to 8 character waypoint names, but if any waypoint name is longer or any waypoint name is duplicated, the Meridian will not even display an otherwise correct SD route file in it's utilities menu.

I'm not going to do a detailed tuytorial on using these utilities, but will note a few key points which will help converting these files.

After starting GPSUtility, click Options/FieldProperties and set the field length to the maximum your GPS will support... 17 in the case of the Magellan's as the increased length will make it much easier to anticipate actions at each turn such as "Merge Rt @ US183"  If the trip is long and complex, you may want to reverse the route for the return trip as the turn direction will be different as well as the possibility of different routing in complex interchanges.

After selecting "Open from Clipboard" of the code in GPSUtility, if there are more than 20 turns, you will be asked for a number of route segments... simply accept the offered number.  If this is presented, you will probably want to edit the route segments to divide them into logical chunks such as day by day segments and label each one to make selection clear and easy.

The conversion will open displaying the "waypoint" table.  Double click the first line and you will get a dialogue box which contains all of the information on each line.  Your primary goal will be to edit the "ID" field to a descriptive tag and perhaps massage the comments field to clarify complex intersection details.

After you finish, but before you press "OK" note the scroll arrows next to the ""OK" button.  These will move the box contents from line to line which makes editing the entire route exceptionally easy.

Finally, switch to the "Route" view and note the entry at the top of the column containing the entry "Driving directions"  Highlight this field and change it to a description of the route such as "AustinSanAntonio" as this will be the "name" displayed on the GPS when you select and set the route to be used.


Web Based Options

GPSVisualizer's GPSBabel converter page at http://www.gpsvisualizer.com/gpsbabel is a web based GPS utility which allows you convert GPX (as well as other) file formats to the file formats your GPS unit requires which can be especially valuable when traveling away from your home comptuer.

Note!  GPSVisualizer cannot handle "accents" which will cause problems with addresses which contain them.

For the Meridian, the selections will be as follows... except for your plain text filename and location.

(Note! I have noticed that there may be some issues specific to the Meridian/Explorist SD file format, which I assume will be worked out as the interfaces are clarified or I learn more ;-)



Once you click the "Convert the File" you will be advanced to a results page with a link to the converted file.

<RightClick> your filename and save it to your computer or directly to the Meridian's SDCard if you have a card reader on your computer.

Note that GPSVisualizer displays the GPSBabel command which was used for the conversion, so, if you use that utility, you can skip GPSVisualizer and run this conversion directly on your PC or laptop.

For the Meridian, the command string (as shown in the image) is;

gpsbabel -r -i gpx -f "SAPhoto.gpx" -o magellan -F "SAPhoto-converted"



At this point, getting the above file into a GPS unit will depend on the make and model of your unit and it's file upload/download capabilities.  As mentioned, with the Meridian, using a USB SD Memory card reader makes it dead simple to get it into the GPS where the file becomes visible and loadable using the Meridian's Menu Card Utilities selection.  Note that the Meridian is limited to "8.3" filenames, so the default name generated by GPS Visualizer will have to be shortened to 8 characters and the extension "WPT" added.

After that, the same will apply as to how you will activate the Route file on your device as each one tends to have differing menu options.

Note that while the "comments" will help you anticipate what you will need to do at each turn, if your GPS has a "Proximity" setting, it will make knowing what to do in advance much easier.  Printing out the Google Map and directions will help as well, especially in congested urban areas.  Most GPS' will also allow you to "reverse" a stored route for the return trip.


EXTRA! Generating Waypoints from Search Results

The above also works to generate waypoint files for Google Map Search Results... for example, searching for;

US POST OFFICE AUSTIN TX

results in a map of pushpins showing search results... running the same process on those results will result in the locations on the current page being included as waypoints in the generated GPX file...

Note, since there are normally multiple pages of results on searches such as the above, you will have to process each page separately and edit them together in one gpx or by multiple imports into programs such as MapSend and reexport.

This also works for single address searches.



To Return to Bev and Rebecca's Home Page, Click Here.

Q: Why do the colors in the above images look funny?
A:  All of the images were captured and their "color depth" reduced to 16 colors to minimize the size of the image files so they will load quickly on slow or expensive data connections such as mobile devices.