Simple Embeddable Twitter Map Mashup
Earlier today, I was pondering the Digital Planet Listeners’ map on open2.net and the #digitalplanet Twitter feed we have running alongside it:
and I started to wonder whether there was a simple way of generating an embeddable map showing the location of people tweeting given a Twitter feed.
I couldn’t find one offhand, so here’s a simple pipe that will do the job: Simple Tweetmap pipe.
Here’s how it works: start off by grabbing a feed from Twitter, such as a Twitter search feed.
Using a Twitter feed URL as an input to the pipe, grab the feed and then find the Twitter username of each individual from the user’s Twitter URL. So for example, map http://twitter.com/psychemedia onto psychemedia.
We now call on another pipe that calls the Twitter API to get personal details for each user who has a Tweet in the feed.
Here’s how that embedded pipe works: Twitter location pipe (it should really be called “Twitter User Details” pipe).
First, construct a URI that ask the Twitter API for the user details associated a particular Twitter username, (e.g. using the construction http://twitter.com/users/show/USERNAME.json) then pull the data back as a JSON feed. Finally, just make sure only a single record is returned (there should only be one anyway).
So the embedded pipe passes back an annotation to the original feed with user details. One of the user details is the user’s location – so let’s geocode it:
Sending the output of the location finder to item.y:location allows the pipe to produce a well formed KML and geoRSS output, that can be displayed in a map, such as the Yahoo! Pipes output preview map:
We can grab the KML URL from the More Options output and display the feed in an embeddable Google map in the normal way (simply enter the KML URI in the Google maps search box and hit Search):
If you want to embed the map in your own page, just grab the embed code…
To summarise the hack, here’s a quick review of the whole pipe:
So now if you want to plot where people who have tagged their tweets in a particular way are tweeting from, you can do :-)
Next step is to persuade the open2 team to start archiving appropriately tagged tweets and displaying them on a cluster map view over time :-) We could maybe even link in a timeline using something like TimeMap, the MIT Simile timeline and Google Maps integration library…?










[...] 27, 2009 At OUseful, Tony Hirst shows how one can take a search feed from Twitter, and run it through Yahoo Pipes, to produce a [...]
TweetMapping Archaeology « Electric Archaeology: Digital Media for Learning and Research
February 27, 2009 at 2:55 pm
Excellent post. Great way to get location details from Twitter and mashup against a geographical map.
Richard Fahey
March 3, 2009 at 7:57 pm
Hey, thanks for making this Pipe … it was exactly what I needed. In the minutes following an unusual small earth tremor in Melbourne, Australia, I decided to map the tweets to see if I could get an sense of how widespread it was. I cloned your Pipe (here: http://pipes.yahoo.com/pansapiens/earthquaketweets ) and used the twitter search http://search.twitter.com/search.atom?q=earthquake+OR+%23earthquake&rpp=100 to show as many recent tweets as I could with the term ‘earthquake’ or hashtag ‘#earthquake’.
I can’t really say it gave me the answer I was looking for, probably because I was about 30 mins late, and by that time there were many people not in the directly effected area tweeting reactions, responding to Melbournians who tweeted about the tremor first hand. Unfortunately the Twitter search API doesn’t seem to have the option to restrict results by exact times (eg “between 8:55 and 9:00 pm”). It would be interesting to map the time-evolution of earthquake tweets over this period – I expect the immediate tweets in the first 2 – 5 mins would cover the directly effected areas, followed by reactions worldwide.
Andrew Perry
March 6, 2009 at 12:16 pm
Digging a little deeper, I’ve noticed that very few Twitterers set their location with exact lat/lon, but only provide a placename at the city level. This means the idea of mapping the effected area of things like earthquakes won’t work very well with any level of detail, since after reverse geocoding, the coodinates of most tweets aren’t really accurate enough to be useful. Maybe once more people start carrying GPS enabled smartphones to update their status (ala Android or iPhone), the data will get more interesting.
Andrew Perry
March 7, 2009 at 5:36 am
@Andrew
There is a half convention that some people use of putting L:placename (e.g. L:Oswaldtwistle) in a tweet to ‘anchor’ it to a location.
This pipe – http://ouseful.open.ac.uk/blogarchive/012696.html – started to explore the geocoding of those sorts of tweet.
Tony Hirst
March 7, 2009 at 12:47 pm
[...] I could only add up to 15 results through the yahoo pipe. A quick look at the comments on the original post about this yahoo pipe shows that there’s an argument in the twitter search api allowing you to specify the amount [...]
Invent Civil » Twitter Watermain Mapping - Part Two
March 25, 2009 at 12:52 am
[...] :-)) :Simple Embeddable Twitter Map Mashup http://tinyurl.com/cgnna8Este u00e9 um teste da funcionalidade do Mashup Twitter.#meshup and #mashup are contemporary [...]
Fresh From Twitter today | zu-web.de
April 3, 2009 at 1:22 am
[...] of course there are all the geo related plugins you could do, such as a simple Tweetmap, or feed annotation services like serendipitwitterous or [...]
Filter Tweets by Language « OUseful.Info, the blog…
May 7, 2009 at 10:11 pm
[...] also: Mapping Realtime Events on Twitter and this Simple Embeddable Twitter Map Mashup] Possibly related posts: (automatically generated)Visualising the OU Twitter NetworkLink Love for [...]
Hyperlocal Twitter Trends « OUseful.Info, the blog…
June 30, 2009 at 1:12 pm
[...] of “demoing twitter – please say hi”, and I typically respond with a link to a Twittermap pipe I created some time ago that takes a URL for a set of Twitter search results and then tries to [...]
Demonstrating Twitter in Conference Presentations « OUseful.Info, the blog…
March 13, 2010 at 5:26 pm
[...] } Possibly related posts: (automatically generated)Simple Embeddable Twitter Map MashupMapping Realtime Events on TwitterFilter Tweets by LanguageThree Stages of Presenting with [...]
Twitter Auto-translation Pipe « OUseful.Info, the blog…
March 19, 2010 at 10:06 am
[...] http://blog.ouseful.info/2009/02/27/simple-embeddable-twitter-map-mashup/ Be Sociable, Share! [...]
twitter maps overlay | SpotGeek.net
July 31, 2012 at 5:43 pm