Skip to content

Commit 7f7e146

Browse files
Merge pull request #573 from meptrsn/patch-1
Update route.R to add wt_profile parameter passthrough to route_dodgr…
2 parents 2672942 + 19e083d commit 7f7e146

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

R/route.R

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ most_common_class_of_list <- function(l, class_to_find = "sf") {
161161
#'
162162
#' @inheritParams route
163163
#' @param net sf object representing the route network
164+
#' @param wt_profile string corresponding to dodgr function weight_streetnet() parameter wt_profile
164165
#' @family routes
165166
#' @export
166167
#' @examples
@@ -172,14 +173,16 @@ most_common_class_of_list <- function(l, class_to_find = "sf") {
172173
#' # colnames(pts) <- c("X", "Y")
173174
#' # net <- dodgr::dodgr_streetnet(pts = pts, expand = 0.1)
174175
#' # osm_net_example <- net[c("highway", "name", "lanes", "maxspeed")]
175-
#' r <- route_dodgr(from, to, net = osm_net_example)
176+
#' r <- route_dodgr(from, to, net = osm_net_example, wt_profile = "bicycle")
176177
#' plot(osm_net_example$geometry)
177178
#' plot(r$geometry, add = TRUE, col = "red", lwd = 5)
178179
#' }
179180
route_dodgr <- function(from = NULL,
180181
to = NULL,
181182
l = NULL,
182-
net = NULL
183+
net = NULL,
184+
wt_profile = "bicycle"
185+
# mimic the default behaviour of weight_streetnet
183186
# ,
184187
# return_net = FALSE
185188
) {
@@ -198,7 +201,7 @@ route_dodgr <- function(from = NULL,
198201

199202
ckh <- dodgr::dodgr_cache_off()
200203
suppressMessages(
201-
ways_dg <- dodgr::weight_streetnet(net)
204+
ways_dg <- dodgr::weight_streetnet(net, wt_profile = wt_profile)
202205
)
203206

204207
verts <- dodgr::dodgr_vertices(ways_dg) # the vertices or points for routing

man/rnet_group.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/route_dodgr.Rd

Lines changed: 10 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)