add_osm_features {osmdata}R Documentation

Add multiple features to an Overpass query

Description

Alternative version of add_osm_feature for creating single queries with multiple features. Key-value matching may be controlled by using the filter symbols described in https://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_QL#By_tag_.28has-kv.29.

Usage

add_osm_features(opq, features, bbox = NULL)

Arguments

opq

An overpass_query object

features

Character vector of key-value pairs with keys and values enclosed in escape-formatted quotations (see examples).

bbox

optional bounding box for the feature query; must be set if no opq query bbox has been set

Value

opq object

References

https://wiki.openstreetmap.org/wiki/Map_Features

Examples

## Not run: 
q <- opq ("portsmouth usa") %>%
     add_osm_features (features = c ("\"amenity\"=\"restaurant\"",
                                     "\"amenity\"=\"pub\""))
# This extracts in a single query the same result as the following:
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

## End(Not run)

[Package osmdata version 0.1.6 Index]