This is a Python script that can convert your location history logs, exported from location tracking apps, into various visualizations, for example, the one that shows you how you were 'uncovering' neighbourhoods of a new city.
This is me exploring Lisbon, Portugal, for 4 days in March 2019 🙂:
Input
: CSV files with location history (latitude and longitude coordinates)
Output
: A set of images that can be combined together to create a gif
You can track your location history with many apps, e.g. Google Maps (Android, iOS) or GPSLogger (Android). Many of them offer a selection of export formats, but if CSV is not one of them, it can be still obtained by converting from KML or GPX.
- Python version 3.3+ to be able to run Python code (download here)
- Jupyter Notebook to be able to read and modify Python code in a nice interface (installation guideline here)
- A tool for converting images into gifs, e.g. ScreenToGif
-
Add your CSV files to the
csv
folder -
Before running the script, open the Command Prompt and navigate to the folder with the
requirements.txt
file -
Run
pip install -r requirements.txt
to install the necessary Python modules -
The script itself is organized into different sections (e.g. "importing CSV files", "defining plot properties", etc.) inside a Jupyter Notebook file
-
To run the script just click
Run
for every code snippet, keeping the sequence -
At some point you will need to add an image of a map to the
maps
folder that will be used in your visualization
You can create one by using the share feature on Open Street Map Export page
- When you finish running the script, all plots will be exported to the
output
folder.
The code snippets to create these visualizations are also included in the main script.
Trace
Heatmap