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.

instruct

Then using the OSGeo4W Shell.
shell

Run the command:

Example:

Then just style it in QGIS as desired.
GoogleTakeOut

3 thoughts on “Mapping Google Location Data

  1. Pingback: Mapping Google Location Data with QGIS – GeoNe.ws

  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\read_location_data.py” “G:\THESIS\Jordan\2019_DECEMBER.json” “G:\THESIS\Jordan\Azraq” output ESRI_Shapefile
    Traceback (most recent call last):
    File “G:\THESIS\Jordan\read_location_data.py”, line 167, in
    main()
    File “G:\THESIS\Jordan\read_location_data.py”, line 161, in main
    write_output(reader, args.output_location, args.output_name, args.output_type.replace(‘_’, ‘ ‘))
    File “G:\THESIS\Jordan\read_location_data.py”, line 118, in write_output
    for entry in in_reader:
    File “G:\THESIS\Jordan\read_location_data.py”, line 15, in make_reader
    for item in json_data[‘locations’]:
    KeyError: ‘locations’

    Reply
    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

      Reply

Leave a Reply

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