library(rjson)
paname=fromJSON(file = "input_Paris.json")
class(paname)
## [1] "list"
extract = function(x){data.frame( x$position$lat,x$position$lng,x$available_bikes )}
velib=do.call(rbind,lapply(paname,extract))
names(velib)=c('lat','lng','nbbikes')
head(velib)
## lat lng nbbikes
## 1 48.86453 2.416171 20
## 2 48.87242 2.348395 22
## 3 48.88215 2.319860 3
## 4 48.86822 2.330494 36
## 5 48.89327 2.412716 17
## 6 48.87039 2.384222 0
library(leaflet)
leaflet(velib)%>% # Ajout du fond de carte
addTiles() %>%
addCircles(lng = ~lng, lat= ~lat, weight = 1,
radius = ~sqrt(nbbikes)*30, popup = ~nbbikes, color = "blue")