Some information that might be of use to someone, at discount prices.

April 21, 2005

Improved MSN and Google GPS GPX Waypoint Extraction

Category: GPS,Software — badsegue @ 9:35 am

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);
}
)()
• • •

No Comments

No comments yet.

Comments RSS

Sorry, the comment form is closed at this time.