get_osm_data <- function( city, amenity ) {
# bound box for city
bb <- getbb(city, format_out = "sf_polygon")
# create overpass query for the amenity
v <- unlist(strsplit(amenity, ':'))
q <- opq(bb) %>% add_osm_feature(key = v[1], value=v[2])
# get the data
return <- osmdata_sf(q, quiet=F)
}
Created on 2019-08-14 by the reprex package (v0.3.0)