Mapping Google Location Data

A cool python script has been created that allows you to easily convert your google location (Takeout) data into a shapefile.

You can get your data from: Google Takeout
And you only need the “Location History – JSON format”

The conversion python script can be downloaded from: GitHub

The python script requires GDAL and its python bindings, but can be easily run if you installed QGIS using the OSGeo4W installer. From the advanced installer, under the Lib section.


Then using the OSGeo4W Shell.

Run the command:

python "C:\FullPath_to_Python_Script\" "C:\FullPath_to_Input_File\LocationHistory.json" "C:\output_path" output_file_name ESRI_Shapefile


python "C:\FilePath\Takeout\Location History\" "C:\FilePath\Takeout\Location History\LocationHistory.json" "C:\FilePath\Takeout\Location History" output ESRI_Shapefile

Then just style it in QGIS as desired.

3 thoughts on “Mapping Google Location Data

  1. Pingback: Mapping Google Location Data with QGIS –

  2. Amali Abraham AMALI

    Hello Heikki,

    Thank you for this helpful script.
    I am trying to run the code on OSGeo4Wshell and it’s generating some error.
    Please do you have any idea what this error may be?

    Here is a brief of it
    C:\OSGeo4W64>python “G:\THESIS\Jordan\” “G:\THESIS\Jordan\2019_DECEMBER.json” “G:\THESIS\Jordan\Azraq” output ESRI_Shapefile
    Traceback (most recent call last):
    File “G:\THESIS\Jordan\”, line 167, in
    File “G:\THESIS\Jordan\”, line 161, in main
    write_output(reader, args.output_location, args.output_name, args.output_type.replace(‘_’, ‘ ‘))
    File “G:\THESIS\Jordan\”, line 118, in write_output
    for entry in in_reader:
    File “G:\THESIS\Jordan\”, line 15, in make_reader
    for item in json_data[‘locations’]:
    KeyError: ‘locations’

    1. Chris Ryan

      Hi Amali,

      Make sure you are using the full “Location History” JSON file for the entire period selected, not the JSON files within years and months.

      This resolves the error regarding Locations but generates new error regarding timestamp formatting (must of been changed since script was written).

      I was able to get past this by commenting out the py script with all date and time references and re organising the list for lat/long as [0] and [1] . Therefore I can display all locations but without full attributes


Leave a Reply

Your email address will not be published. Required fields are marked *