Created
May 3, 2024 05:14
-
-
Save ratnanil/ecad3d946f41e6967433eaa6583f1103 to your computer and use it in GitHub Desktop.
Import Google Timeline / Location History
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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