Tuesday, December 24, 2013

Google Location Data

Using this blog post as my guide, I downloaded the location data that Google stores about me and plotted it via R: http://seasci.wordpress.com/2013/12/20/it-knows-where-i-live/

The json file downloaded from Google Takeout was 123 MBs, over 780k location records. It takes several minutes for the script to parse all those records.

The blog author is from UK so I needed to adjust map parameters to my relevant locations.

This script uses get_map() a lot. Here's the documentation for get_map(): http://www.inside-r.org/packages/cran/ggmap/docs/get_map

I also tried to convert the json file to a csv prior to importing into R using this py script: https://github.com/Scarygami/location-history-json-converter/blob/master/location_history_json_converter.py
I modified the csv output format a bit to include accuracy data and to add a comma between lat and lon. I think because there were some records without accuracy, I was getting errors so applied a Catch KeyError function to the accuracy line. This helped me: http://stackoverflow.com/questions/16154032/catch-keyerror-in-python

Next I need to modify my R script to read in csv instead of json.




No comments:

Post a Comment