q <- getbb ("portsmouth", display_name_contains="United States") %>% opq () %>%
add_feature("amenity", "restaurant") %>%
add_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_feature("amenity", "restaurant")
q2 <- getbb ("portsmouth", display_name_contains="United States") %>% opq () %>%
add_feature("amenity", "pub")
c (osmdata_sf (q1), osmdata_sf (q1)) # all objects that are restaurants OR pubs
# Use of negation to extract all non-primary highways
q <- opq ("portsmouth uk") %>% add_feature (key="highway", value="!primary")
Run the code above in your browser using DataLab