Git Product home page Git Product logo

google_timeline_maps's Introduction

google_timeline_maps

Mapping Google Timeline data with Processing 2 & the Unfolding library

While this started out as a very hacky personal project to map my own data, once I shared some of my visualizations I started getting requests from friends wanting to make their own. While it's still hacky, this is a rough first pass at streamlining my workflow for more general use. I've listed a few ideas for future development at the bottom of this page. Feel free to use https://github.com/bdharva/google_timeline_maps/issues to suggest additional updates and flag any bugs you encounter.

Sample visualization

Application Setup

Note: These directions are for Mac OS X users. If you're using Windows or Linux, you'll be following a similar process, but will need to reference OS-specific directions at each of the websites indicated below and for Terminal-based steps.

Install Processing 2

To utilize the Unfolding maps library, you'll need to be running Processing 2 (not 3). If you don't already have it installed, go to https://processing.org/download/ and scroll down to "Stable Releases". Click the OS-appropriate download link for version 2.2.1. Unzip the archive and move the extracted "Processing" application to your "Applications" folder.

Install Unfolding library

Go to http://unfoldingmaps.org/ and click the "For Processing 2" button under "Download". Unzip the archive and put the extracted "Unfolding" folder into the libraries folder of your Processing directory. By default, the Processing directory will be at User/Documents/Processing. If this is your first library, you'll need to create a libraries directory within it.

Install Python

If you don't already have Python installed on your machine (you can check with python -V in Terminal), follow the documentation here to select and install the correct version. The parts of this process that utilize Python should work just fine whether you're running version 2.x or 3.x.

Clone project repository

In Terminal, navigate to your Processing directory and execute git clone https://github.com/bdharva/google_timeline_maps.git to create a local clone of the repository.

Preparing Data

Download Google Timeline data

Access your Google Takeout at https://takeout.google.com/settings/takeout. De-select everything except "Location History". Be sure that the "JSON format" option is selected. Follow the remaining steps to create and download your archive. Once downloaded, unzip the archive and move the extracted Location History.json file to the sketch directory .../google_timeline_maps/data/google.

Filter and transform data

In Terminal, navigate to the same directory where you've just saved your location history file. If you want to map the full unfiltered dataset, simply execute python parse.py. If you'd like to filter the data to a given date range, execute python parse.py [start_date] [end_date], with the dates formatted as YYYY-MM-DD. The Python script is just converting the .json file to .csv, re-formatting coordinates, and stripping away extraneous data not necessary for mapping.

Mapping Your Data

Launch the sketch

Open the google_timeline_maps.pde sketch in Processing 2 and launch the sketch with cmd + r or by pressing the play icon in the user interface. Depending on the size of the timeline dataset you're loading, it might take a little while for the interface to load once you run the sketch.

Theory of operation

When the sketch finishes launching, you'll start out on the "views" interface. Views can be defined with latitude and longitude, zoom level, the title you'd like to display on exports, and the preferred file name for those exports. The guides at the bottom of the page will help you to configure some views and change interfaces.

Sample visualization

Short of developing a longer list of presets or a more robust inerface (not working on either at the moment), I recommend that you start by Googling city coordinates and then fiddling around in the map/plot view to fine tune things -- more on that in a second.

Pressing S will switch into the settings menu, where you can configure how you'd like your views to be rendered when mapping and plotting data. The annotated screenshot below lays out how these settings correspond with the output.

Sample visualization

From the views interface, you can toggle to a map of the view with M. Here you can pan and zoom to get the view right, and the underlying settings for the view will be automatically updated and saved. Pressing P will toggle on and off a plotted view of the data overlaid on the map.

Every time you plot the data, the view will be saved under the specified file name. Note that if the guides are displayed while plotting, they will be included in the export. I tend to leave them on while fine-tuning the view, and then hide them when I'm ready to plot my final export. It's also worth noting that, for now, the map cannot be panned or zoomed while data is plotted.

Exports will be saved in /exports nested within the directory that you're running the sketch from. All files will be prefixed with the date, so multiple plots of a given view on a given day will overwrite one another unless you change the specified file name for the view.

Development Notes

Known Bugs

  • None at the moment

Known "Papercuts"

  • Lack of proper data validation on form inputs; lack of error handling for errors that this can introduce
  • Can't show/hide guides while plotting data; have to un-plot, hide guides, and re-plot to export clean graphic
  • Can't pan/zoom map while data is plotted
  • New views are created in a bullshit random order
  • Map guide text/icons collide when user-specified export size is too small

Future Development

  • Enable users to constrain date range of plotted data directly within program
  • Remove need for Python transforms; load Google JSON straight into program
  • Provide as standalone application once all data wrangling is handled in-app
  • Provide previews of style customizations in settings menu
  • Enable users to specify alternate map tile providers

google_timeline_maps's People

Contributors

bdharva avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.