GPSBabel (http://www.gpsbabel.org) makes it possible to convert the driving directions from Google Maps into various formats that allow them to be used by other software and devices.  This is possible because Google encodes the coordinates of the entire route in the JavaScript that is sent to the Google Maps client and used to generate highlight paths.

 

The first step is, of course, to get Google Maps to make some driving directions.  We’ll use one of the examples given on the Google Maps home page.  Enter “jfk to 350 5th ave, new york” and hit the Search button.   After a short calculation, a map will appear with the route highlighted.

 

Now, we need to get the output into a predictable format.  To do that, we first need a URL that contains everything we need to recreate our route.  Fortunately, Google provides the “Link to this page” option, which gives us just that.  Click “Link to this page.” The displayed map won’t change, but the URL in the address bar will contain your query and some additional parameters.

 

The last step is to modify that URL to output the JavaScript that the Google Maps client uses internally.  To do that, just add “&output=js” to the end of the URL in your address bar and hit enter.  The resulting page will appear mostly blank, but the HTML source contains all the data we need to extract the coordinates of the route.  Save that page to your local hard disk with the File / Save As… menu option.  If you are using Internet Explorer, make sure to select “Web Page, HTML Only (*.htm, *.html)” from the “Save as type” dropdown.  Saving as “Web Page, Complete” will cause the file to be rewritten as non-compliant XHTML, which GPSBabel will not be able to read.  Give the file a name – we’ll call ours ‘nyc.htm’ – and hit the “Save” button.

 

Now we finally have a file to feed to GPSBabel.  What can we do with it?  One thing we can do is reduce the route Google Maps has computed for us to a smaller number of points and upload it to a handheld GPS unit.  While GPSBabel comes with a GUI front end, its real power lies in the command-line interface.  For our example, we must use the command-line interface because the GUI does not support filters.  Start a command prompt, make sure that GPSBabel is in your path, and cd to the directory where you saved your map file.  Connect a supported Magellan or Garmin GPS receiver to com1 (or some other serial or USB port.)  Assuming you used com1, type the following, all on one line, and hit enter:

 

For a Magellan GPS receiver:

gpsbabel –i google –f nyc.htm –x simplify,count=30 –o magellan –F com1:

 

For a Garmin GPS receiver:

gpsbabel –i google –f nyc.htm –x simplify,count=30 –o garmin –F com1:

 

That’s it!  GPSBabel will read the driving directions produced by Google Maps, pick the 30 most salient points along the route, and upload the new route to your GPS receiver.