Get Your Google Location History On The Map

3701
0
03-17-2022 07:17 AM
BruceHarold
Esri Regular Contributor
4 0 3,701

This article is another spinoff from the recent (at writing) 2022 Esri Partner and Developer conferences in Palm Springs, California, where an attendee asked if we could see where his Android phone goes.  Well we can't, but the phone owner sure can, and as usual with ArcGIS Data Interoperability, it's no-code easy!

If you enable location history on your Android device you can download periodic snapshots of the location data, along with many other variables, from Google's Takeout site.  There are a lot of things you can package up in any download, if you're only interested in location data deselect all options and scroll about 2/3 the way through the options to find Location History, and select it:

Location HistoryLocation History

 While setting up your export there are some options to send the data to a cloud store, these are accessible to Data Interoperability too:

Export OptionsExport Options

 

When you get some data you'll see it is in month chunks as JSON documents, for example 2022_MARCH.json.  There are a number of object types in the data; places visited, activities that describe movement (like driving and walking, but many more possibilities), places parked at and child places, where visiting a place was judged to result in secondary place visits - like shopping.  Everything has coordinates and UTC time stamps and places have street addresses and business names.

The data is probabilistic, meaning Google's guess at how you moved and where you visited is given a rank amongst a number of possibilities.  You'll see in the tools in the post download I only preserved the highest ranking option.  I rate the accuracy as very high.

So how did I ingest this data and what does it look like?

I created a custom format for the JSON (details below) and some raw data looks like this when it lands in a geodatabase:

Raw Location HistoryRaw Location History

 

The linework isn't very inspiring at first glance (but see below); while start and end points are usually accurate, waypoints are only captured at sparse intervals, something like every 20 minutes (don't quote me on that, I haven't done a rigorous analysis).  At small scales the 'routes' are way off:

Activity ExtentActivity Extent

 

 However, we can uplift the data by replacing the routes with those solved by the ArcGIS Online Routing Service. Here is how the data looks after that treatment:

Uplifted RoutesUplifted Routes

 

Much better!  The routes are not perfectly accurate but do use the start, waypoint and stop coordinates, plus traffic conditions if the data isn't too old.

If we go back to the full extent we can see some activities in mid extent (shopping?) and in Palm Springs (working?).

Destination ActivitiesDestination Activities

 

First the supposed shopping:

Desert Hills at CabazonDesert Hills at Cabazon

 

I can recommend the date shake at the place famous for them :-).

How about the final destination?

Palm Springs Convention CentrePalm Springs Convention Centre

 

The Esri conference!

I will not pick through the tools in detail, but in the download you will find:

FileDescription
GoogleLocationHistory.fmwWorkspace to create the custom format
RouteActivitySegments.fmwWorkspace to route the custom format
GOOGLE_LOCATION_HISTORY_JSON.fdsCustom format definition

 

Copy the fds file into your default custom format folder (you can set up other shares in FME options too).  That is a path like this:  C:\Users\<username>\Documents\FME\Formats

Spoiler
If you experience a crash of Pro when using the custom format you have hit a known bug which will be fixed in Pro 3.0, in the meantime just reboot your machine and the crash will not reoccur.

I used Data Interoperability for Pro 2.9 so you'll need that release or later.  The routing functionality requires an ArcGIS Online account with routing permissions and will consume credits.  I used the default travel modes for my organization, if you want to tune yours see this help topic.

If you are new to Data Interoperability there is an Easy Button.  Install and license the extension, this delivers a toolset named Data Interoperability Tools, in there is a tool Quick Import.  Open that tool, search for the input custom format Google Location History JSON choose a destination file geodatabase name and run the tool - it will deliver the data (unrouted) into the new file geodatabase.  If you want the data routed you can edit and run RouteActivitySegments.fmw with the Workbench app or create a new ETL tool in a toolbox with RouteActivitySegments.fmw as its source and run it interactively.

Now you are all set, go get that location history into your GIS!