Twitter Stream from US Only

TW Streaming I won't lie, Twitter's streaming API is pretty amazing. I still find it amazing that companies like twitter give out so much much information for free. The streaming API returns a fraction of all current tweets an allows you to filter based on many different factors. One of the factors is location. So if you want only geo-coded tweets (which I do) that's not hard to do. Here is a quick tutorial on how to only get tweets from the US.

If we want geocoded tweets only from the US, we have to specify longitude and latitude points for the US. Twitter only lets you specify rectangles. So I selected 3 rectangles, 1 for Alaska ([-169.90,52.72],p-130.53,72.40]), 1 for Hawaii([-160.6,18.7],[-154.5,22.3]) and 1 for the continental US([-124.90,23.92],[-66.37,50.08]). The tricky part about this is that you have to give 2 points, the first being the bottom left point and the second being the top right point. If this isn't right, you'll get all kinds of weird errors. Also, when you combine them in the locations field, you just put them in a row:

locations=[-169.90,52.72,-130.53,72.40,-160.6,18.7,-154.5,22.3,-124.90,23.92,-66.37,50.08]  

But this will basically get you all tweets from the US. It will actually get you more, but those you can filter out after the fact!


What I Learned Today:
Lucy(1964–1987) was a chimpanzee that was raised as if she were a human child. She was taught how to eat with silverware, dress herself, flip through magazines, and sit in a chair at the dinner table. She was learned over 140 signs taken from American Sign Language. Amazingly, she was able to combine signs to express herself creatively.