Monday, 2 June 2014

What Google Knows About Me

Two things coincided recently:

  • I was tinkering with creating a web capability that would allow my wife to track my whereabouts.
  • The fact that Google had created the capability for people to wipe their personal data.

So that got me thinking, what did Google know about me in terms of location?  I recall setting a permission to allow applications to use my location and am aware that Google Maps always opens up at my current location and I get location-centric search results.  Hence I assume that Google periodically logs my location, something I'm reasonably comfortable with.  To me the benefits outweigh the downsides and there are some crowd sourced location capabilities (e.g. Maps Traffic overlay) that I rely on so it's only fair that I share my location.

I recall using Google Latitude in the past and that it had an API.  However Latitude was "retired" a couple of years ago and, from a bit of searching, was apparently replaced by Google+.  When I looked at my Google+ profile my location was  there so I assumed that this would be  available via the Google+ API.  Hence I registered for the Google+ API and got myself an API key.

This URL:<put_your_google_id_here>?key=<put_you_key_here>

Yielded this JSON:
 "kind": "plus#person",
 "etag": "\"YFr-hUROXQN7gOa3dpHg9dQ8eq0/0LQ1cdZ_xacNSKto12345j_fXA\"",
 "gender": "male",
 "objectType": "person",
 "id": "my_id
"displayName": "Paul Weeks",
 "name": {
  "familyName": "Weeks",
  "givenName": "Paul"
 "url": "",
 "image": {
  "url": ""
 "isPlusUser": true,
 "circledByCount": 1,
 "verified": false

So no location.  Additionally, no matter what URL I used, I could not get my location via the Google+ API.  Equally, no end of searching yielded a way to do this via the Google+ API.  Hence it seems good old Google retired the Latitude API without supplying a replacement.  Nice one Google.

More searching showed me that there is a (pretty inelegant) way to get your location history.  Google provide it via Google Maps via this URL:  Here you can use the web interface to set a date range and view where you've been.  You can also export to KML to get a dump of you location history, playing with the timestamp parameter to get a different time period.  This epic Blog provides more details and gives a nifty way to automate the process with cURL and PHP.

An example URL is as follows:

...and the timestamps are Unix style so each day is 24*60*60*1000 = 86,400,000 milliseconds long. Using this URL format I requested a year's worth of data (so startTime = endTime - {365 * 86,400,000}).  After a short delay (maybe 10 seconds) I was served with a large KML file.

Looking at the file I spotted that it only went back to mid-October 2013, so about 7 months worth of data. I'm not sure whether I did something back in October '13 to trigger Google storing my location, more likely there's some form of limit as to how much data they provide access to.  I also spotted that there were 186,930 locations logged!  That's nearly 900 per day!  Many of which were duplicates of the same location which doesn't seem to be the most efficient way to do things.  One day I'll investigate this some more.

From old tinkerings I knew you can upload a KML file to Google Fusion Tables and visualise it on a map.  However with this file and the 186,930 data points, Google wouldn't render a map.  Hence I did some Excel jiggery pokery to remove duplicates from the location list and only use lat/long to 3 decimal places and got it down to a mere 918 data points.

Visualised on Google Fusion Tables it looks like this:

So you can see how I spend most of my time in England and have traveled to the Netherlands, Germany, Romania and Hungary this year. There's also a puzzling data point in Iran - somewhere that I absolutely, definitely have not traveled to ever!

The English data points are interesting:

       You can see how I spend most of my time in the central South area, travel occasionally to that London and have also visited relatives in the north-west of England.  The little circle around Birmingham shows I've used the orbital motorways in both direction and the direct line up the centre of the country was for a long distance bike ride I did.

Interesting, (but slightly scary),stuff.  Must think of more ways to use this data...