
Last chance! 50% off unlimited learning
Sale ends in
Add a feature to an Overpass query
add_osm_feature(
opq,
key,
value,
key_exact = TRUE,
value_exact = TRUE,
match_case = TRUE,
bbox = NULL
)
An overpass_query
object
feature key
value for feature key; can be negated with an initial
exclamation mark, value = "!this"
, and can also be a vector,
value = c ("this", "that")
.
If FALSE, key
is not interpreted exactly; see
https://wiki.openstreetmap.org/wiki/Overpass_API
If FALSE, value
is not interpreted exactly
If FALSE, matching for both key
and value
is
not sensitive to case
optional bounding box for the feature query; must be set if no opq query bbox has been set
opq object
Features defined within an add_osm_features call are combined with a logical OR.
Chained calls to either add_osm_feature or add_osm_features()
combines
features from these calls in a logical AND; this is analagous to chaining
dplyr::filter()
on a data frame.
add_osm_features()
with only one feature is logically equivalent to
add_osm_feature()
.
Other queries:
add_osm_features()
,
bbox_to_string()
,
getbb()
,
opq_around()
,
opq_enclosing()
,
opq_osm_id()
,
opq_string()
,
opq()
,
overpass_status()
# NOT RUN {
q <- opq ("portsmouth usa") %>%
add_osm_feature(key = "amenity",
value = "restaurant") %>%
add_osm_feature(key = "amenity", value = "pub")
osmdata_sf (q) # all objects that are restaurants AND pubs (there are none!)
q1 <- opq ("portsmouth usa") %>%
add_osm_feature(key = "amenity",
value = "restaurant")
q2 <- opq ("portsmouth usa") %>%
add_osm_feature(key = "amenity", value = "pub")
c (osmdata_sf (q1), osmdata_sf (q2)) # all restaurants OR pubs
# Use of negation to extract all non-primary highways
q <- opq ("portsmouth uk") %>%
add_osm_feature (key = "highway", value = "!primary")
# }
Run the code above in your browser using DataLab