Improved MSN and Google GPS GPX Waypoint Extraction
background
Previously we showed how to pull GPS waypoints from MSN Yellow Pages and Google Maps results using bookmarklets. One solution was Firefox-only, and the other was more reliable in IE. Here we present a solution that is a little more elegant and should work in either browser.
For those using Google Maps, they have now added UK maps. The scripts had to be updated to accomodate the -d.dddddd longitudes.
approach
To support IE the bookmarklets must be implemented using the ’script injection’ technique. This involves rewriting the head of the HTML page to add a reference to an external script. Firefox has additional security restrictions that prevent injected scripts from doing certain actions, like opening new windows. This version avoids this restriction by writing the GPX file to a DIV block in the current page.
implementation
The new bookmarklets simply contain the code necessary to inject the external script into the page. Just right-click or drag them to add to your favorites/bookmarks. To use them visit the appropriate page and select the bookmark.
Here is the new MSN GPX RIP bookmarklet, and the code:
javascript:
(function(){
var script=document.createElement('script');
script.src='http://badsegue.org/samples/msngpxripdiv.js';
document.getElementsByTagName('head')[0].appendChild(script);
}
)()
Here is the new Google GPX RIP bookmarklet, and the code:
javascript:
(function(){
var script=document.createElement('script');
script.src='http://badsegue.org/samples/googgpxripdiv.js';
document.getElementsByTagName('head')[0].appendChild(script);
}
)()


Google Maps UK waypoint extraction
Yey! With Google introducing Google Maps UK Badsegue.org has released an updated and upgraded script that handles waypoint extraction from the UK maps. The old script didn’t work for the UK and an update was required that allowed the scripts…
Trackback by GPS-Notes — April 21, 2005 @ 4:14 pmHere’s a bunch of restaurants near Corolla, NC. I assembled these using the waypoint extractors. Most of them are from MSN, as they don’t limit searches to 10 results. I pasted the results from each search result page into a text file and then opened them up in G7toWin.
Comment by badsegue — May 5, 2005 @ 6:50 amI’ve found that when doing ordinary address searches the bookmarklet doesn’t return anything. Does this only work with actual locations that are listed in the directory as a business?
Comment by jer — May 12, 2005 @ 9:58 amjer - These scripts only find the points returned from a business search. If you specify a specific address it returns differently formatted results, which the script won’t find. I can modify the script to detect which type of search was performed and handle these specific address searches.
Comment by badsegue — May 16, 2005 @ 6:12 amGoogle Map Hack
I’ve created a hack for Google Maps which lets you turn driving directions into a GPX file suitable for downloading to a GPS. There are already hacks out there (including non-hackish apps using the official API) which let you go the other way–from a …
Trackback by Communications From Elsewhere — July 29, 2005 @ 12:28 pmThis is just what I’m looking for, except: it doesn’t work for me either under firefox 1.0.6 or IE 6.0. In both cases, it says ‘Nothing found here.’ and that’s it, even thought the browser is pointing at maps.google.com, and shows a valid route between two points. I even tried with with google’s route example “seattle to 98109.”
Thoughts?
Comment by Don — July 30, 2005 @ 9:20 pmDon: the bookmarklet described here doesn’t work for driving directions, only for points of interest. I’ve combined one I wrote with the one here to make a bookmarklet that will work for driving directions, single addresses and points of interest in a local search - http://www.elsewhere.org/GMapToGPX/
Also, badsegue, I found a bug in yours: the regular expression you’re matching on assumes that both latitude and longitude will be \d{1,2}\.\d{6}. But longitude should be \d{1,3}\.\d{6}
Comment by Josh — July 31, 2005 @ 6:43 am