# NOT RUN {
q <- getbb ("portsmouth", display_name_contains = "United States") %>%
opq () %>%
add_osm_feature("amenity", "restaurant") %>%
add_osm_feature("amenity", "pub")
osmdata_sf (q) # all objects that are restaurants AND pubs (there are none!)
q1 <- getbb ("portsmouth", display_name_contains = "United States") %>%
opq () %>%
add_osm_feature("amenity", "restaurant")
q2 <- getbb ("portsmouth", display_name_contains = "United States") %>%
opq () %>%
add_osm_feature("amenity", "pub")
c (osmdata_sf (q1), osmdata_sf (q2)) # all restaurants OR pubs
# Use nodes_only to retrieve single point data only, such as for central
# locations of cities.
opq <- opq (bbox, nodes_only = TRUE) %>%
add_osm_feature (key = "place", value = "city") %>%
osmdata_sf (quiet = FALSE)
# }
Run the code above in your browser using DataLab