Skip to content

Commit

Permalink
add pedestrian highway to wt_profiles
Browse files Browse the repository at this point in the history
  • Loading branch information
mpadge committed Jun 25, 2019
1 parent 791b2e5 commit d8bf3fb
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: dodgr
Title: Distances on Directed Graphs
Version: 0.2.0.003
Version: 0.2.0.004
Authors@R: c(
person("Mark", "Padgham", email="[email protected]", role=c("aut", "cre")),
person("Andreas", "Petutschnig", role="aut"),
Expand Down
3 changes: 2 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# v0.2.0.001
# v0.2.0.00x

Minor changes:
* Add "highway:pedestrian" to weighting profiles
- `weight_streetnet` for `sc` objects automatically adds component column
- bug fix in `weight_streetnet.sc(..., wt_profile = 1)`
- bug fix in `dodgr_full_cycles` for `SC` class objects
Expand Down
10 changes: 7 additions & 3 deletions data-raw/pkg-data-scripts.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,13 @@ nms <- sapply (weighting_profiles, function (i) i [1, 1])
wt_ls <- c (95, 80, 95, 95, 60, 50, 40, 30, 30, 30) # living street
wt_br <- c (100, 100, 50, 70, 0, 0, 0, 0, 0, 0) # bridleway
wt_fw <- c (100, 100, 100, 90, 0, 0, 0, 0, 0, 0) # bridleway
names (wt_ls) <- names (wt_br) <- names (wt_fw) <- nms
wt_fw <- c (100, 100, 100, 90, 0, 0, 0, 0, 0, 0) # footway
wt_ped <- c (100, 20, 100, 80, 0, 0, 0, 0, 0, 0) # pedestrian
names (wt_ls) <- names (wt_br) <- names (wt_fw) <- names (wt_ped) <- nms
newrows <- data.frame ("living_street" = wt_ls,
"bridleway" = wt_br,
"footway" = wt_fw)
"footway" = wt_fw,
"pedestrian" = wt_ped)
weighting_profiles <- lapply (weighting_profiles, function (i) {
newdat <- t (newrows [rownames (newrows) == i [1, 1], ])
newdat <- cbind (i [seq (ncol (newrows)), 1],
Expand Down Expand Up @@ -156,6 +158,7 @@ speeds [ways == "path"] <- 12
speeds [ways == "steps"] <- 4
speeds [ways == "bridleway"] <- 8
speeds [ways == "footway"] <- 4
speeds [ways == "pedestrian"] <- 4
weighting_profiles$max_speed [weighting_profiles$name == "bicycle"] <- speeds
# wheelchair
Expand All @@ -168,6 +171,7 @@ speeds [ways == "track"] <- 2
speeds [ways == "steps"] <- NA_real_
speeds [ways == "bridleway"] <- NA_real_
speeds [ways == "footway"] <- 4
speeds [ways == "pedestrian"] <- 4
weighting_profiles$max_speed [weighting_profiles$name == "wheelchair"] <- speeds
# horse
Expand Down
Binary file modified data/weighting_profiles.rda
Binary file not shown.
6 changes: 2 additions & 4 deletions tests/testthat/test-sc.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,10 @@ test_that("SC", {
expect_true (nrow (net_sc) > 0)

net_sf <- weight_streetnet (hampi)
# The SC version is sanitised by, for example, removing duplicate
# edges, so is a more compact graph:
expect_true (nrow (net_sf) > nrow (net_sc))
expect_equal (nrow (net_sf), nrow (net_sc))
v_sc <- dodgr_vertices (net_sc)
v_sf <- dodgr_vertices (net_sf)
expect_true (nrow (v_sf) > nrow (v_sc))
expect_equal (nrow (v_sf), nrow (v_sc))

class (hsc) <- class (hsc) [!class (hsc) %in% "osmdata_sc"]
expect_error (net_sc <- weight_streetnet (hsc),
Expand Down

0 comments on commit d8bf3fb

Please sign in to comment.