-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscooters.R
35 lines (30 loc) · 920 Bytes
/
scooters.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# VOI scooter data
library(httr)
library(tidyverse)
library(jsonlite)
# Helsinki
resp <- fromJSON("https://api.voiapp.io/v1/vehicle/status/ready?lat=60.16952&lng=24.93545")
data <- resp %>%
mutate(r = map(location, ~ data.frame(t(.)))) %>%
unnest(r) %>%
rename(lat = X1,
lon = X2) %>%
select(-location) %>%
filter(battery >= 80 & locked == TRUE)
p <- ggplot() + theme_minimal()
p <- p + geom_point(data=data,
aes(x=lon, y=lat),
color= alpha("darkgreen", 0.3)) +
geom_point(aes(y=60.1704507, x=24.9386955), colour="red", size = 5) +
labs(title = 'VOI electric scooters in the Helsinki metropolitan area',
subtitle = "Status: locked, and battery level at least 80%") +
theme(axis.title = element_blank())
p
ggsave(
"voi.png",
width = 35,
height = 25,
dpi = 72,
units = "cm",
device='png'
)