I am a geography teacher and would love to map tweets in QGIS for my pupils. I followed all the instructions but it seems Twitter have changed the way they stream their tweets. I can cope with the GIS side but I am not a Twitter developer. Is there any advice you can give a very busy teacher on getting those tweets?
I used to do this with curl as described here, but Twitter removed basic authentication support from public streaming endpoints on June 11, 2013, so you need to use OAuth. In order to do this you need to have a Twitter account and request an application.
Below is a very simple example, written in Python using the twython library.
from twython import TwythonStreamer # supply your OAuth values below APP_KEY = 'xxxx' APP_KEY_SECRET = 'xxxx' ACCESS_TOKEN = 'xxxx' ACCESS_TOKEN_SECRET = 'xxxx' class MyStreamer(TwythonStreamer): def on_success(self, data): if 'coordinates' in data: try: print 'lat: ', data['coordinates']['coordinates'], 'lon: ', data['coordinates']['coordinates'], '\n' except: pass def on_error(self, status_code, data): print status_code, data stream = MyStreamer(APP_KEY, APP_KEY_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET) stream.statuses.filter(locations='-180,-90,180,90')
If Python is not your language of choice, there are other options.