Hi. Good morning! Today we will have fun with Python by playing with social media data.
As background knowledge it is assumed that you know what a JSON is. If not, have a look at JSON Intro. Also acquaint yourself yourself with the datastructure of tweets. You can find it on API Tweets. Try to find out for example where spatial references are made in a tweet.
There are various packages to work with twitter data in Python. One great Python package for twitter data handling is Twython. Twython is an actively maintained, pure Python wrapper for the Twitter API. It supports both normal and streaming Twitter APIs. Today we will work with both APIs. Let's setup the conda environment for today with the Spyder IDE.
conda create --name twitterpython python=3 geopandas spyder
conda activate twitterpython
conda install --channel conda-forge twython folium matplotlib psycopg2
Below are the Jupyter Notebooks that contain the tutorials for today.
Connecting and harvesting real-time tweets
Create a twitter harvesting application that harvests tweets (either real-time or stored), and create a spatial dataset and map from it. The application should be able to: collect tweets based on a thematic and/or spatial query.
Suggestions:
Send in your application as a python script as well as a screenshot of the map you produced.
If you want to go beyond todays tutorials, have a look at some cookbooks and examples: