-
Notifications
You must be signed in to change notification settings - Fork 45
Open
Description
Instead of requiring the features parameter for add_osm_features()
be provided with escape-formatted quotations, it would be great to support a named list. The following reprex shows how this could be added with a fairly minor change. Happy to open a pull request if you're interested!
library(osmdata)
#> Data (c) OpenStreetMap contributors, ODbL 1.0. https://www.openstreetmap.org/copyright
q1 <- opq ("portsmouth usa") %>%
add_osm_features (features = c (
"\"amenity\"=\"restaurant\"",
"\"amenity\"=\"pub\""
))
add_osm_features_ext <- function(opq, features, bbox = NULL) {
if (is.list(features)) {
features <- paste0('\"', names(features), '\"=\"', features, '\"')
}
add_osm_features(opq, features, bbox)
}
q2 <- opq("portsmouth usa") %>%
add_osm_features_ext(
features = list(
"amenity" = "restaurant",
"amenity" = "pub"
)
)
identical(q1, q2)
#> [1] TRUE
Created on 2022-11-09 with reprex v2.0.2
Metadata
Metadata
Assignees
Labels
No labels