TwitterWhere – Filter Tweets by Location

Inspired by a post over at Silicon Florist about following local people on Twitter, I investigated whether it was possible to follow someone in a geographic area. The closest I found was TwitterVision, which is a great idea, but doesnt exactly do what I want. So I ended up taking a few hours and developed TwitterWhere, an aggregator that watches the Twitter public timeline and geocodes what it finds. From there anyone can generate an RSS or XML feed that will pull only Tweets within a set radius around an area. Now you can have a feed of Tweets within 50 miles or Portland, or 5 miles of Manhattan,

For anyone who is interested, heres how I pulled it off

I wrote the app in Ruby on Rails, utilizing my favorite gem of all time, Graticule (geocoding and spatial search), Hpricot (parsing the public timeline on Twitter), and a couple custom geocoding libraries I already had cooked up for Unthirsty and Knitmap.

Every minute I query the Twitter public timeline XML file and the results. If a new user is entered into the system it is geocoded and any Tweets added by that user from that point inherit the coordinates. Any users with an invalid location are thrown out and not cached. I also cache geocode queries locally. Both of these measures are in place so I dont overload the geocoding services I use (especially considering I have two other fairly heavy traffic sites using geocoding services).

On the front end, feeds are not exactly generated, its more of a verification that the location someone has entered is geocodable. Once the location is verified a link is presented to the user that points to RSS or XML feeds. If this ends up getting more traffic, Ill consider using caching for each unique feed, but right now when you visit a feed URL, it is generated from the database in real time, every time.
TwitterWhere runs on my good old Dual 1.8GHz Powermac G5 at our co-location facility, using a custom compiled Apache 2.2, mod_proxy_balancer and 5 mongrels.

Okay, Im done geeking. Here are few mentions of TwitterWhere from around the web. Thanks for the write-ups!

  • Silicon Florist – TwitterWhere: Get tweets by geographic location
  • ReadWriteWeb – TwitterWhere Tracks Tweets from Any Location,
  • Wired Blog – TwitterWhere Tracks Tweets By Location

P.S. Apologies to, I didnt even think to check if the domain existed, let alone to see if there was something there! We dont exactly do the same thing ( allows you to easily update your current location on Twitter), so hopefully there isnt too much confusion.

Leave a Reply

Your email address will not be published. Required fields are marked *