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

opq_osm_id

Add a feature specified by OSM ID to an Overpass query


Description

Add a feature specified by OSM ID to an Overpass query

Usage

opq_osm_id(id = NULL, type = NULL, open_url = FALSE)

Arguments

id

One or more official OSM identifiers (long-form integers), which must be entered as either a character or numeric value (because R does not support long-form integers).

type

Type of object; must be either node, way, or relation

open_url

If TRUE, open the OSM page of the specified object in web browser. Multiple objects (id values) will be opened in multiple pages.

Value

opq object

Note

Extracting elements by ID requires explicitly specifying the type of element. Only elements of one of the three given types can be extracted in a single query, but the results of multiple types can nevertheless be combined with the c operation of osmdata.

References

See Also

Examples

## Not run: 
id <- c (1489221200, 1489221321, 1489221491)
dat1 <- opq_osm_id (type = "node", id = id) %>%
    opq_string () %>%
    osmdata_sf ()
dat1$osm_points # the desired nodes
id <- c (136190595, 136190596)
dat2 <- opq_osm_id (type = "way", id = id) %>%
    opq_string () %>%
    osmdata_sf ()
dat2$osm_lines # the desired ways
dat <- c (dat1, dat2) # The node and way data combined

## 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.