February 01, 2008

Geo Twitter - GeoCoding Your Tweets and Plotting Them on an Embeddable Map

I was just catching up on a few feeds over coffee, I read this snippet in a post by repository hacker David Flanders on What is Twitter?

My initial answer was what can we do with the Twitter API: especially the idea of a phone app that posted my twitter from a Google maps location so you could actually see where the Twits were coming from.

Twittervision and Twittermap already offer geo-location tools, and an API for you to set your location:

You can set the location using any of the following forms: =london, l=san_francisco, l:place=Los_angeles, geo=MILTON_KEYnes (all case insensitive). In deference to a converntion Brian Kelly is using, the pipe will also accept a ':' instead of the '=', so l:Xiang should work okay... Spaces in the location name should be replaced by an underscore (_).

The pipe looks for the declared location, and temporarily pops it (and it alone) into the post title, (purely within the context of the pipe, of course - your feed isn't affected anywhere else). The pipe location extractor actually looks for a location in the title and description elements of the feed. The twitter feed puts the whole tweet (I think) in the both the title and the description of the feed, so by pulling out the declared location we hopefully give the location extractor a big clue as to the location we want to extract and geocode;-) If you don't explicitly mark up the location, the geocoder may well pull it out of the full tweet in the description part of the feed anyway...

If the location extractor recognises the location, it will add geo-rss elements to the feed:

To run the pipe, simply provide your Twitter name (and pop a location in a recent tweet using one of the techniques mentioned above.