1. Home
  2. How to & Use Cases
  3. How to get visited places from Google Location History KML or JSON files

How to get visited places from Google Location History KML or JSON files

People all over the world are tracking their location with their cell phones more and more often. Today, there are about three and a half billion smartphone users worldwide, almost half the global population. About 84% of the total number of smartphone users, use a phone with the Android operating system from Google (about 16% use the iOS operating system from Apple). And most of these almost 3 billion Android users have active the Google Location History service, which is used to track the user’s location when the phone is turned on and receiving a mobile signal (GPS signal is not necessary).

Google Location History service

Location History is a Google Account–level setting and you can turn it on or off at any time in “Location History” section of the Google Account settings. On the Google Maps website, you can view your Timeline, which shows an estimate of places you may have been and routes you may have taken based on your Location History. You can view there your location history for a specific time period, manage your Timeline settings, or export and download your location history data.

There are two types of data available for download:

  1. You can export and download the location data for the day you are viewing by clicking on Settings (Gear icon) on the bottom right and selecting “Export this day to KML”.
  2. You can download your entire location history data by clicking on Settings (Gear icon) and selecting “Download a copy of all your data”, which leads to the Google Takeout website.

There is unfortunately nothing between just one day or entire history – only these to possibilities of download are available at Google Maps.

KML file is not always the same

As the number of people tracking their location using a smartphone grows worldwide, there is also a growing demand for a tool that can successfully extract data from the complete location history exported from Google Takeout. But it is very difficult to process such large amounts of unstructured data from Google.

It works quite well when you want to extract visited places from a KML file exported from Google Maps for one specific day. You can convert this KML file to, for example, an Excel spreadsheet, using general file format converter such as MyGeodata Converter, because there are clearly defined points for all visited places and lines always connecting two visited places.

When you need to get a location timeline over a longer time period than just one day, it’s much more complicated. The only way is to utilize a copy of all your Google location data downloaded from Google Takeout. Although you can also download a KML file, it has a very different structure than the one you get from Google Map for just one day. In raw location history data obtained from Google Takeout, Google only records location in the form of points recorded at certain time intervals and these points are connected into one very long line. Unfortunately, it doesn’t identify the individual places you’ve visited, as it does when viewing your location history on Google Maps from a single day.

JSON Location History file from Google Takeout

You can also download your location history data from Google Takeout website in JSON file format (which is also the default download setting). You get data in an Google’s proprietary format based on JavaScript Object Notation (JSON) which is a text-based, lightweight data-interchange format. Most programming languages such as Python, C#, Java, JavaScript, etc. provide libraries for reading and working with this kind of data, but if you are not a skilled programmer, it is quite difficult to view such data.

How to get location timeline for a specific time period

There is a specialized tool for extracting visited places from Google Location History, that identify the places you have most probably visited by deeply analyzing the stored time and location information in a KML file with copy of all your Google location data downloaded from Google Takeout. Although some of your visits / stops may not appear in the resulting data, the analysis is set up to be as precise as possible and there is a large number of complex calculations and spatial analyzes behind this tool that allow to achieve incredibly accurate results.

The tool extracts the places you have visited according to data recorded by Google Location History service in six simple steps:

Step 1: Download your Location History data from Google Takeout website (you will need to sign in to your Google account). There are two formats to choose from. The JSON file format, which is also the default setting for downloading, and the KML file format, which needs to be manually selected.

Step 2: Go to the “Google Location History – extract visited places” tool.

Step 3: Upload your data downloaded from Google Takeout website.

Step 4: Set the Date filter (optional) – Set the time range in which you want to process the data. You can select Last week (last 7 days of the entire time range), Last month, Last year, Full time range or you can set Start and End date in which you want to identify the visited places.

Step 5: Set the Spatial filter (optional) – draw the area of interest on a map in which you want to identify the visited places. If you don’t specify the filter you’ll simply get all the places from around the world for the specified time period.

Step 5: Set the extraction parameters:

You can select to get Original estimated locations by Google or locations of visited places computed on original data (based on spatio-temporal analysis). If you select the second option, you can choose whether the resulting information about the places visited will be detailed (even short stops lasting only a few minutes, e.g. waiting for public transport), less detailed (only visits lasting tens of minutes to a few hours) or just a rough estimate of the most important places visited.

To your resulting data you can also add an attribute with the name of the location you were to for each place you visited.

If you want to get all the source points extracted from the raw Google Location data (one very long line) that was the basis for determining the visited places, you can select the option and export these points to a separate file.

You can also select the output data file format. You can choose from spreadsheets formats CSV or MS Excel and vector formats ESRI Shapefile, GeoJSON, GPKG or SQLite/SpatiaLite.

Some of the above-mentioned parameters may not appear. It depends on what input data is being processed.

Step 6: Download the resulting file with your visited places and that’s it.

Updated on June 1, 2021

Was this article helpful?

Related Articles

Leave a Comment

Close Bitnami banner
Bitnami