Of course, this only applies to Twitter. The percent of geotagged media varies by social network source. For example, Instagram had up to 25% of photos geotagged by users in 2012, according to the New York Times.
We will take a look at the twitteR package in R that provides an interface with the Twitter API. The main reason I chose this was my familiarity with R.
Getting a Twitter Dev Account
First, head over to https://apps.twitter.com/. You can use your regular Twitter account to login. Click on the "Create New App" button in the upper right-hand corner. Follow the on-screen instructions and be sure to read the Developer Agreement.
After your "app" is created, click on the "Permissions" tab and make sure the last radio button is selected: "Read, Write, and Access direct messages." Also check out the Keys and Access Token, especially if you are more familiar with connecting to APIs.
Connecting with R
For this blog, I am using R 3.1.3 64-bit. Start R, then follow the instructions located in the screenshot below. Click the screenshot for a closer look.
Click the above screenshot to get a closer look. |
In addition to the code listed above, you will have to install one additional package:
install.packages('base64enc')
Otherwise, you will oauth errors.
Concluding remarks...
Connecting to and using an API may not be your strong suit, but it is not mine either! Hopefully, I've saved you some time and got you connected to this valuable source of data!
You can also now follow me on Twitter at: @jontheepi. I will post blog updates there as well as additional quick insights about open source GIS and mapping.