Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

opq_enclosing

opq_enclosing


Description

Find all features which enclose a given point, and optionally match specific 'key'-'value' pairs. This function is not intended to be combined with add_osm_feature, rather is only to be used in the sequence opq_enclosing -> opq_string -> osmdata_xml (or other extraction function). See examples for how to use.

Usage

opq_enclosing(
  lon = NULL,
  lat = NULL,
  key = NULL,
  value = NULL,
  enclosing = "relation",
  timeout = 25
)

Arguments

lon

Longitude of desired point

lat

Latitude of desired point

key

(Optional) OSM key of enclosing data

value

(Optional) OSM value matching 'key' of enclosing data

enclosing

Either 'relation' or 'way' for whether to return enclosing objects of those respective types (where generally 'relation' will correspond to multipolygon objects, and 'way' to polygon objects).

timeout

It may be necessary to increase this value for large queries, because the server may time out before all data are delivered.

See Also

Examples

## Not run: 
# Get water body surrounding a particular point:
lat <- 54.33601
lon <- -3.07677
key <- "natural"
value <- "water"
x <- opq_enclosing (lon, lat, key, value) %>%
    opq_string () %>%
    osmdata_sf ()

## End(Not run)

osmdata

Import 'OpenStreetMap' Data as Simple Features or Spatial Objects

v0.1.10
GPL-3
Authors
Mark Padgham [aut, cre], Bob Rudis [aut], Robin Lovelace [aut], Maëlle Salmon [aut], Andrew Smith [ctb], James Smith [ctb], Andrea Gilardi [ctb], Enrico Spinielli [ctb], Anthony North [ctb], Martin Machyna [ctb], Marcin Kalicinski [ctb, cph] (Author of included RapidXML code)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.