Skip to content

Instantly share code, notes, and snippets.

@denniskawurek
Created June 15, 2019 20:18
Show Gist options
  • Save denniskawurek/7f2852c75a00dcc5ca2daf9a29c4117d to your computer and use it in GitHub Desktop.
Save denniskawurek/7f2852c75a00dcc5ca2daf9a29c4117d to your computer and use it in GitHub Desktop.
Visualize all collected data points of your Google Maps location history
# Visualizes your Google Maps location history on a Map using OpenStreetMap
# If you want more information (e.g. number of collected points per day), consider this post https://shiring.github.io/maps/2016/12/30/Standortverlauf_post
library(mapview)
library(jsonlite)
x <- fromJSON("") # Add here the path to your .json
loc = x$locations
# converting time column from posix milliseconds into a readable time scale
loc$time = as.POSIXct(as.numeric(x$locations$timestampMs)/1000, origin = "1970-01-01")
# converting longitude and latitude from E7 to GPS coordinates
loc$lat = loc$latitudeE7 / 1e7
loc$lon = loc$longitudeE7 / 1e7
dots <- data.frame(x=loc$lon,
y=loc$lat)
coordinates(dots) <- ~ x + y
proj4string(dots) <- "+init=epsg:4326"
mapview(dots, label=loc$time, cex=2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment