Last active
May 30, 2024 06:57
-
-
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
# 1. go to https://takeout.google.com/ | |
# 2. Deselect all "Products" | |
# 3. Select only the following product: Location History (Timeline) | |
# 4. Follow the other steps to get a json export of your Location history | |
# 5. Download and extract the data in your RStudio Project folder | |
# 6. Follow the script below | |
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