10 minutes
[This article was first published on r.iresmi.net, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Day 13 of 30DayMapChallenge: « 10 minute map » (previously).
Where can you go in 10 minutes (by car) from Les Minutes?
library(osrm) library(leaflet) library(glue)
Data
We use {osrm} to build the isochrone. The service is based on OpenStreetMap data.
loc <- c(4.1485138, 45.8725235)
isochrone <- osrmIsochrone(loc = loc,
breaks = 10, res = 50)
Easy…
Map
Easily too, and fast with {leaflet}.
isochrone |>
leaflet() |>
addTiles(attribution = glue("<a href='https://r.iresmi.net'>r.iresmi.net</a> – {Sys.Date()}. Data OSRM & <a href='https://www.openstreetmap.org/copyright'>© OpenStreetMap</a>, ODbL ; <a href='https://openstreetmap.org/fixthemap'>Fix the map</a>")) |>
addPolygons() |>
addAwesomeMarkers(lng = loc[1], lat = loc[2])
In less than 10 minutes…
To leave a comment for the author, please follow the link and comment on their blog: r.iresmi.net.
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
