Building on a story we did a while back, on how to stream Twitter lists without using the Twitter Streaming API, and going with a much simpler proxy of the Twitter API using Streamdata.io, we wanted to apply the same code to a geographic region using Twitter Geo API. In case you wanted to tune into what is being said around a specific location, going beyond just searching by hashtag, or from lists of users you have already defined.
The Twitter Streaming API takes an investment to get up and running, where proxying the Twitter REST API using Streamdata.io, only takes a couple of seconds. Making for a much more efficient way to stream social data from the platform. There are several different ways you can stream tweets from the Twitter Geo API that can be found here, using a couple of different parameters.
1) Latitude / Longitude – Passing in the actual coordinates.
curl -v "https://streamdata.motwin.net/https://api.twitter.com/1.1/geo/search.json?lat=[latitude]&long=[longitude[&X-Sd-Token=[streamdata api key]" -H "Authorization: Bearer [token]"
2) Query – Using the name of a landmark or location.
curl -v "https://streamdata.motwin.net/https://api.twitter.com/1.1/geo/search.json?query=[landmark]&X-Sd-Token=[streamdata api key]" -H "Authorization: Bearer [token]"
3) IP Address – Providing an IP address to perform geolocation on.
curl -v "https://streamdata.motwin.net/https://api.twitter.com/1.1/geo/search.json?ip=[ip_address]&X-Sd-Token=[streamdata api key]" -H "Authorization: Bearer [token]"
All you need to begin streaming Tweets by location using one of the above commands is a Twitter OAuth token, and a Streamdata.io application key that you can get with our free plan. Providing a quicker, simpler way to stream data from Twitter via an web or mobile application. If you have higher volume needs, the Twitter Streaming API might be a good choice, but for most other situations, proxying using Streamdata.io is going to make a lot more sense, and take you just a fraction of the time.
We are going to keep profiling the different possibilities for streaming of Twitter data using Streamdata.io. We’d like to have a full toolbox of ready to go streams, for some of the most commonly used, and highest value Twitter API paths for our customers to put to use in their applications. Once we have a complete list of possible paths that can provide valuable streams, we will work on a way to define a list of topics, to further define a publish and subscribe view of Twitter, and how Streamdata.io can provide meaningful, precise streams of social data for users to subscribe to.