4 bottles of coke, 3 days and a lot of mashed code. That is how much it took for me to roll out the first prototype of GeoTweets. GeoTweets is an web-based application to show Tweets about a location on a map. Using the Google maps API v3 as a map and gathering the tweets with the Twitter search API allows the application to show tweets on a location about that location.
The concept for this prototype was created for the course Multi-media systems at Leyden University (Netherlands). The initial concept was to show what location on the world most tweets were about. Due to technical limitations this evolved into an application that lets user click to find out what is happening on a location. The locations are saved together with the activity ratio, this is then displayed on the map as active active and recent locations.
The application has been build on the Ruby on Rails framework, naturally to the framework it uses MVC as architectural pattern. The application only has one real class, Location… not that it needs anything else. The map controller takes care of displaying the map, maintaining the different interface levels that are store in the session and showing the tweets itself. The map has a system that catches clicks on the map and the markers that were placed from the existing locations. These clicks are converted into data that is sent trough a pipeline hidden form that is submitted. The action that follows is that the window is opened and the form does an AJAX call to full the window with tweets.
Another mechanism uses the same pipeline. It is possible to search with word to a location, the Google maps API turns that into valid location information and submits it trough the same pipeline. The total package allows a 3 way interface to open a window; from a coordinate (click), from a set of words (search and link) and from already existing information (existing locations).
Limitations and problems
Due to the nature of twitter and the nature of the worlds geographical naming this is not always perfect but in general it gives at least a decent gist on what is being twitted about that location. The problem with this idea is that Twitter trends only go that far and do not always have a location as a basis. So search is the only result that can be used to show tweets on locations. This is done with Custom searches via the Twitter search API that generates a json that is used to fill a google maps window with tweets.
The problem actually still remains… What if I’m looking for New York? no, not the city, the state New York. As a result from twitter I would almost always get some confusion here… People don’t tweet New York state… and even if they do it still shows up when searching for New York city. I’m not even mentioning the town York in the United kingdom as it will also show posts from New York! Adding the country in this case will also probably not work as Tweets with York, United Kingdom are rare and space is scarce in tweets. Solving this problem… not yet done! But is this actually solvable? We need to think about it!
The plan is to continue work on it to get it publishable. Right now the code really needs some refactoring and security needs some attention to make it safe to use for the public. I have placed the code on code.google.com to make it open and accessible. Interested? Join in with the fun, it’s open!