This is a wrapper around viaroute that returns a single route between A and B.
route_osrm(from, to, l = NULL, alt = FALSE, ..., singleline = TRUE)
| from | Text string or coordinates (a numeric vector of
|
|---|---|
| to | Text string or coordinates (a numeric vector of
|
| l | Only needed if from and to are empty, in which case this should be a spatial object representing desire lines |
| alt | Boolean value to return alternative routes (default = TRUE). |
| ... | Arguments passed to viaroute() |
| singleline | Should a single line be returned? Default is |
The public-facing OSRM routing service (the default) only provides routing for cars by default. For details, see https://github.com/Project-OSRM/osrm-backend/issues/4530.
# NOT RUN { from <- c(-1.55, 53.80) # geo_code("leeds") to <- c(-1.76, 53.80) # geo_code("bradford uk") r <- route_osrm(from, to) plot(r) r_many <- line2route(flowlines_sf[2:9, ], route_osrm) plot(cents) plot(r_many, add = TRUE) # }