JSON: How to Read Your Google Location Data

Header

A few days ago, I was actively avoiding my life plans (and scrolling through WordPress) when I stumbled upon a GIF from Vincze Istvan showing where Google had plotted his locations over the last few years.

And my brain exploded. I mean, I knew in the back of my mind that anytime I checked my email or looked for directions or asked Lyft for a ride, my information at that particular time and place was probably being stored somewhere. That storage place had always felt far too abstract to make me paranoid.

Until I saw it projected in a GIF in a supremely tangible way.

So I followed the instructions to get my own data. You start out in Google Maps and hit the Menu.

To The Menu

Select “Your Timeline” from your options.

The Timeline

And behold. This is everywhere Google thinks I’ve been over the last five years or so.

My Google Locations

At first, I was horrified. Partially because the map really demonstrates how my ADD translated into major life decisions—old sublets, temp jobs, road trips. They’re all over the place. I’ve been a hot mess. Then I paused.

Silly Google, I thought, I’ve never been to Minneapolis. But then I clicked the red dot for details. Minneapolis-Saint Paul International Airport, it said. You had a layover on December 4, 2015, it said.

It was correct.

So there was my giant revelation for the week. Google remembers more about where I’ve been than I do.

What Does This Have to Do With JSON?

After embracing the horror, I immediately decided I wanted to see the raw data. Like, chop it up, poke it a little, and try to figure out why Google thinks I’ve never been to El Paso. I was literally there just a few days ago. No red dot. At this point, I’m still not sure what that’s about.

Back to the point.

You can download your location history with a few clicks.

Download Data

Then click next and follow the prompts. You can also grab a KML from here, but given the number of points, I’m thinking it might crash GoogleEarth.

So I downloaded the .json file, opened it in Notepad, and thought to myself, hey genius, you don’t know how to read JSON.

Hold up. What is JSON?

I’ve been dancing around JSON since I started learning about scripts (mainly web scrapers) because it’s damn near everywhere on the internet. It stands for JavaScript Object Notation, which sounds gross and intimidating.

Don’t panic.

It’s just a way to store data. A JSON object can store strings, numbers, arrays, boolean values. It’s basically a digital closet organized into key/value pairs.

What’s a Key/Value Pair?

Think of the key as a descriptor of the data or value you want to store. If “Character” is the key, “Rainbow Randolph” could be the value. To make a JSON object, alls you got to do is pop the key/value pairs in curly brackets separated with commas.

{ "Character": "Rainbow Randolf", "Actor": "Robin Williams", "Theme Song": "Friends come in all sizes"}

Here’s where things get a little complicated. You can make an key with an array value to store a lot of associated data. Arrays are stored in regular brackets. Here’s an example of a movie key associated with an array of its characters.

{"Death to Smootchy": ["Rainbow Randolf", "Smoochy the Rhino", "Buggy Ding Dong"]}

And here’s where things can really start to screw with your head. You can nest JSON objects. That’s right. Key/value pairs within key/value pairs. So you can have a movie associated with an array of characters–and details about each of those characters in their own objects.

{ "Death to Smoochy": [{ "Character": "Rainbow Randolf", "Actor": "Robin Williams", "Theme Song": "Friends come in all sizes"}, { "Character": "Smoochy the Rhino", "Actor": "Edward Norton", "Theme Song": "Here comes the cookie"}]}

You just have to watch out for all the brackets. The more complex the get, the easier it is to misplace one. Google Location History is not on the happy end of the complexity spectrum.

JSON Format

What are the Google Location History Keys?

The keys are timestampMS, latitudeE7, longitudeE7, accuracy, velocity, (sometimes heading), altitude, verticalAccuracy, and activity.

TimestampMS is a string. Everything else other than Activity is a number. Activity is an array. The Activity array has four nested JSON objects, each with their own Activity key associated with yet another nested JSON object including Type and Confidence keys.

I’m assuming this is because Activity is determined by getting your position over four successive moments in time to figure out whatever the heck you were doing. My activities were categorized into “STILL”, “IN_ROAD_VEHICLE”, “IN_VEHICLE”, “EXITING_VEHICLE”, “vehicle_personal_confidence”, “WALKING”, “RUNNING”, “ON_FOOT”, “TILTING”, “IN_RAIL_VEHICLE”, “ON_BICYCLE”, and “UNKNOWN.”

I’m unclear on the difference between on foot and walking, also in vehicle versus vehicle personal confidence. The others I’m assuming are determined by how fast you’re moving. I genuinely don’t know what tilting is about. If you happen to find others, please post them in the comments because I’m curious.This maps to Las Vegas if you're wondering...

Notice that it starts off with { “locations”: [ meaning all your locations are within an array in that one value.

What’s with the Time and Coordinate Values?

You may have noticed timestampMs looks funky. It’s not a traditional date display with a day, month, and year.

There exists a thing called Unix time. It’s counting upwards from January 1, 1970. The numbers you see in timestampMS are the milliseconds that have passed since then. There’s a converter at www.epochconverter.com which also has a marvelous breakdown of how to get Unix time in different coding languages.

So for instance, my times in the nested JSON objects above are:

1518020678010 = February 7, 2018 at 4:24:38.010 PM GMT
1518020917050 = February 7, 2018 at 4:28:37.050 PM GMT
1518021168024 = February 7, 2018 at 4:32:48.024 PM GMT
1518021413969 = February 7, 2018 at 4:36:53.969 PM GMT

So basically one every four minutes for 12 minutes. The timestampMS in the JSON object holding the coordinates is less than a minute later.

1518021441000 = February 7, 2018 at 4:37:21 PM GMT

The latitude and longitude values might look familiar because it’s just standard decimal degrees without the actual decimal points.

Google Earth

That’s all I’ve got for the moment. I’ve got plans for follow-up on this one over the next few months.

Best of luck in your own Google Location History data dives.

 

 

 

 

 

Advertisements

10 thoughts on “JSON: How to Read Your Google Location Data

  1. I’m curious if you could explain all the red dots? Recently, my husband downloaded my map history data using JSON, and according to all the dots, has concluded that I have cheated on him numerous times with numerous people. These dots on my map show homes/businesses that I’ve never been to before, and people I’ve never even heard of, let alone met. He has since kicked me and our son out of the house, and we have moved on, but it still bothers me that Google has placed me at several locations (sometimes for hours) that I have never been to. What exactly ate these red dots supposed to show?

    Liked by 1 person

    1. My condolences on the marriage, Melissa. We’ve ALL been there. Rule #1 for your next spouse–hands off the JSON data. Your red dots are sacred. They must be guarded like gold codes.

      Better yet, marry a luddite. Herd cats. Move to the Kamchatka Peninsula. I doubt Google will find you there.

      To be honest, I’m still not sure what causes the red dots. They just appear. Like magic. If you ever get a decent handle on it, please shoot an explanation my way.

      Thanks for stopping by. I so rarely hear from people passing through.

      Liked by 1 person

    1. Wow Melissa, that is absolutely brutal. On the other hand, it’s best to avoid people who are that controlling and assumptive by nature. I am curious about your mystery locations in your Google location history though, and where this data came from.

      I wonder if perhaps you live in a very rural area and/or shut of your GPS sometimes, in which case Google or your device will sometimes estimate your location based on various information like nearby cell towers.

      Or, if you’ve signed-in to another device with your Google Account at some point (maybe someone else’s device, maybe some app or website that the person rarely uses, so they don’t realize you’re signed in), in which case maybe *that* device’s location is being combined with your *actual* location data.

      Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s