Add a feature specified by OSM ID to an Overpass query
opq_osm_id(id = NULL, type = NULL, open_url = FALSE)
One or more official OSM identifiers (long-form integers)
Type of object; must be either node
, way
, or relation
If TRUE
, open the OSM page of the specified object in web
browser. Multiple objects (id
values) will be opened in multiple pages.
opq object
https://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_QL#By_element_id
# 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
# }
Run the code above in your browser using DataLab