Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new types to oe_get_network #224

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 42 additions & 2 deletions R/get-network.R
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
#' plot(its_driving["highway"], lwd = 2, key.pos = 4, key.width = lcm(2.75))
oe_get_network = function(
place,
mode = c("cycling", "driving", "walking"),
mode = c("cycling", "driving", "walking", "cycle_infrastructure"),
...
) {
# Load the relevant oe_get options
Expand All @@ -94,7 +94,8 @@ oe_get_network = function(
mode,
cycling = load_options_cycling(place),
walking = load_options_walking(place),
driving = load_options_driving(place)
driving = load_options_driving(place),
cycle_infrastructure = load_options_cycle_infrastructure(place)
)

# Check the other arguments supplied by the user
Expand Down Expand Up @@ -220,6 +221,45 @@ load_options_driving = function(place) {
)
}

load_options_cycle_infrastructure <- function(place) {
list(
place = place,
layer = "lines",
extra_tags = c(
"sidewalk_left_bicycle", "cycleway_left",
"cycleway_right", "cycleway", "oneway_bicycle",
"sidewalk_right_bicycle", "bicycle", "cycleway_both"
),
vectortranslate_options = c(
"-where", "
sidewalk_left_bicycle = 'yes'
OR
sidewalk_right_bicycle = 'yes'
OR
cycleway_left IN ('shared_lane', 'shared_busway', 'track', 'lane')
OR
cycleway_right IN ('shared_busway', 'shared_lane', 'track', 'lane')
OR
cycleway_both = 'lane'
OR
cycleway IN ('shared_busway', 'opposite_lane', 'lane', 'track', 'opposite_track')
OR
(highway = 'bridleway' AND bicycle = 'no')
OR
bicycle = 'use_sidepath'
OR
(cycleway = 'opposite' AND oneway_bicycle = 'no')
OR
highway = 'cycleway'
OR
(highway = 'path' AND (bicycle = 'designated' OR bicycle = 'official'))
OR
(highway = 'pedestrian' AND (bicycle = 'yes' OR bicycle = 'official'))
"
)
)
}

# The following function is used to merge the vectortranslate options set by the
# mode of transport and the other oe_get options set by the user.
check_args_network = function(dots_args, oe_get_options) {
Expand Down
6 changes: 5 additions & 1 deletion man/oe_get_network.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.