if (FALSE) {
library(sf)
apotheke.sf <- st_read(system.file("gpkg/apotheke.gpkg", package = "osrm"),
quiet = TRUE
)
# Get isochones with lon/lat coordinates
iso <- osrmIsodistance(loc = c(13.43, 52.47), breaks = seq(0, 500, 100))
# Map
plot(iso["isomax"], breaks = sort(unique(c(iso$isomin, iso$isomax))))
# Get isochones with an sf POINT
iso2 <- osrmIsodistance(loc = apotheke.sf[11, ], breaks = seq(0, 500, 100))
# Map
if (require("mapsf")) {
mapsf::mf_map(
x = iso2, var = "isomin", type = "choro",
breaks = sort(unique(c(iso2$isomin, iso2$isomax))),
pal = "Burg", border = NA, leg_pos = "topleft",
leg_val_rnd = 0,
leg_frame = TRUE, leg_title = "Isochrones\n(min)"
)
}
}
Run the code above in your browser using DataLab