Skip to content

Instantly share code, notes, and snippets.

@ratnanil
Created May 3, 2024 05:14
Show Gist options
  • Save ratnanil/ecad3d946f41e6967433eaa6583f1103 to your computer and use it in GitHub Desktop.
Save ratnanil/ecad3d946f41e6967433eaa6583f1103 to your computer and use it in GitHub Desktop.
Import Google Timeline / Location History
library(sf)
library(jsonlite)
library(dplyr)
gt <- jsonlite::read_json("takeout-20240501T094208Z-001/Takeout/Location History (Timeline)/Records.json",simplifyVector = TRUE)
df <- gt[[1]]
# inspired by the following SO-answer
# https://gis.stackexchange.com/a/319067/40929
df2 <- df |>
mutate(
lat = latitudeE7/1e7,
lon = longitudeE7/1e7
) |>
st_as_sf(coords = c("lon", "lat"), crs = 4326)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment