Find all elements related to an ID

Share:

Description

For a given ID these functions return all IDs of related elements.

Usage

1
2
3
find_down(object, ids)

find_up(object, ids)

Arguments

object

An osmar object

ids

A vector of IDs tagged whether they are node, way, or relation

Details

find_down finds all elements downwards the hierarchy:

node -> node
way -> way + node
relation -> relation + way + node

find_up finds all elements upwards the hierarchy:

node -> node + way + relation
way -> way + relation
relation -> relation

Value

A list with the three elements node_ids, way_ids, relation_ids

See Also

Other finding: find_nearest_node; find

Examples

1
2
3
4
5
data("muc", package = "osmar")
  o1 <- find(muc, way(tags(k == "highway" & v == "pedestrian")))

  find_down(muc, way(o1))
  find_up(muc, way(o1))