One-click mashup: gmap + geonames bookmarklet

Doing some research for url_pipe for DemoCampMontreal4, I went around looking for the state-of-the-art in feed technology. Some of this stuff was too cool not to turn into a bookmarklet.

Create a bookmark (e.g. “Map this!”), with the following for location:
javascript:links = document.getElementsByTagName('link');for(var i=0; i < links.length; i++) {if (links[i].rel == 'alternate') {this.location = 'http://maps.google.com/maps?f=q&hl=en&q=' + 'http://ws.geonames.org/rssToGeoRSS?feedUrl=' + encodeURIComponent(links[i].href);}}

Now try clicking it on while visiting the Standoutjobs blog or Crunchboard for an instant mapping mashup.

How it works: this will grab the first alternate link on a page (RSS/Atom - it could break if it’s print!), and send you to Google Maps. The magic bit is provided by Geonames’ rss-to-georss converter, which adds geographic location to a feed before GMap gets its hands on it.

Again, this could break very easily. If you go to the 37signals job board, there is no alternate link - the RSS is in the main body. Nothing really bad happens, it’s just not very elegant.

Any suggestions as to how to make this better, or improvements are appreciated. Wordpress doesn’t like code in comments, so please post any code on your favourite pasting site. (It also wouldn’t let me create an easy to drag bookmarklet. Any hints on how to make it do that would be appreciated).

1 comment so far ↓

#1 QuebecValley - Startups in Quebec and the Valley on 08.18.07 at 12:32 am

[…] DemoCamp and I think it was great! I was really impressed by PodBean and Daniel Haran’s url_pipe. Daniel’s presentation gave me some great ideas and after talking to him, I’ll make […]

Leave a Comment