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:
  • L:place=address[:] store a personal location

  • L:place[:] set a stored personal location as current location

  • L:address[:] set an arbitrary location as current location

So here's my offering, a Yahoo Pipe that will have a go at geocoding locations declared in a tweet - Geo-twitter Pipe - http://pipes.yahoo.com/ouseful/geotwitter:


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.

In a sort of related post - Displaying Google Calendar Events on a Map - I show how you can take the output of a pipe as KML and plot it on a Google map or within Google Earth etc...


Enjoy :-)

PS if you want to know where your friends are: http://pipes.yahoo.com/ouseful/geotwitterfriends .

So for example, here's where the people I follow are tweeting about at the moment:

View Larger Map

PPS A question for the community - should I add a filter to the pipe so that it only contains geotagged items?

Blogged with Flock

Tags: , , , , ,

Posted by ajh59 at February 1, 2008 12:18 PM

It's quite effective if you plug in BarackObama's twitter ID. Shows what a mental amount of travelling he's doing at the moment.

Posted by: Richard at February 1, 2008 03:40 PM

Why not create a Pipes using API TwitterVision?

Posted by: Jean-NoŽl at February 1, 2008 05:52 PM

Yes. Yahoo pipes reverse geo coding works pretty well. I tried it on Global Voices RSS feed and it works. http://thejeshgn.com/projects/global-voices-on-map/

Posted by: Thejesh GN at February 3, 2008 05:59 PM