Skip to contents

Returns all (not deleted) relations in which the given object is used.

Usage

osm_relations_object(
  osm_type = c("node", "way", "relation"),
  osm_id,
  format = c("R", "xml", "json"),
  tags_in_columns = FALSE
)

Arguments

osm_type

Object type ("node", "way" or "relation").

osm_id

Object id represented by a numeric or a character value.

format

Format of the output. Can be "R" (default), "xml", or "json".

tags_in_columns

If FALSE (default), the tags of the objects are saved in a single list column tags containing a data.frame for each OSM object with the keys and values. If TRUE, add a column for each key. Ignored if format != "R".

Value

If format = "R", returns a data frame with one OSM object per row. If format = "xml", returns a xml2::xml_document following the OSM_XML format. If format = "json", returns a list with a json structure following the OSM_JSON format.

See also

Other get OSM objects' functions: osm_bbox_objects(), osm_get_objects(), osm_history_object(), osm_ways_node(), osmapi_objects()

Examples

node <- osm_relations_object(osm_type = "node", osm_id = 152364165)
node
#>       type       id visible version changeset           timestamp
#> 1 relation   347950    TRUE     108 158257114 2024-10-23 14:35:37
#> 2 relation   349035    TRUE     168 159714558 2024-11-28 18:25:25
#> 3 relation   349053    TRUE     803 157400973 2024-10-03 03:20:01
#> 4 relation  2417889    TRUE      60 156148820 2024-09-03 15:53:44
#> 5 relation  2807397    TRUE     111 152390043 2024-06-07 19:08:20
#> 6 relation 11746917    TRUE     225 160270818 2024-12-14 07:50:00
#> 7 relation 11747082    TRUE     416 160175048 2024-12-11 16:11:48
#>                user      uid  lat  lon
#> 1          pantufla  9104166 <NA> <NA>
#> 2 Hugoren Martinako  3392826 <NA> <NA>
#> 3   RusticCloud3325 16996508 <NA> <NA>
#> 4          jmaspons 11725140 <NA> <NA>
#> 5            EliziR   605366 <NA> <NA>
#> 6       Atalanttore   291453 <NA> <NA>
#> 7             Accai 21847683 <NA> <NA>
#>                                                           members
#> 1 97 members: node/152364165/admin_centre, way/96647329/outer,...
#> 2 515 members: node/152364165/admin_centre, way/45319680/outer...
#> 3 2231 members: node/152364165/admin_centre, node/602512999/la...
#> 4 113 members: node/152364165/admin_centre, way/185724656/oute...
#> 5 449 members: node/152364165/admin_centre, way/45327666/outer...
#> 6 2205 members: node/152364165/admin_centre, way/585618147/out...
#> 7 3509 members: node/8000963558/label, node/152364165/admin_ce...
#>                                                                                  tags
#> 1 35 tags: admin_level=8 | alt_name:gl=Barna | border_type=municipi | boundary=adm...
#> 2 33 tags: admin_level=6 | boundary=administrative | ine:provincia=08 | ISO3166-2=...
#> 3 69 tags: admin_level=4 | alt_name:el=Καταλονία | alt_name:eo=Katalunujo | alt_na...
#> 4 24 tags: admin_level=7 | border_type=comarca | boundary=administrative | idescat...
#> 5 13 tags: boundary=political | idescat:àmbit=01 | name=Àmbit metropolità | name:a...
#> 6 10 tags: boundary=political | default_language=ca | name=Català com a llengua pr...
#> 7 44 tags: boundary=political | name=Països Catalans | name:an=Países Catalans | n...

way <- osm_relations_object(osm_type = "way", osm_id = 372011578)
way
#>       type      id visible version changeset           timestamp       user
#> 1 relation 5524720    TRUE      44 160173410 2024-12-11 15:25:40 Toni Serra
#>       uid  lat  lon
#> 1 3859465 <NA> <NA>
#>                                                           members
#> 1 184 members: way/372006138/, way/372006137/, way/486335278/,...
#>                                                                                  tags
#> 1 9 tags: distance=62.65 | name=GR 179 Sender dels Maquis | network=nwn | operator...

rel <- osm_relations_object(osm_type = "relation", osm_id = 342792)
rel
#>       type       id visible version changeset           timestamp
#> 1 relation   349012    TRUE     126 159714558 2024-11-28 18:25:25
#> 2 relation 11739086    TRUE     111 158240704 2024-10-23 07:50:26
#>                user     uid  lat  lon
#> 1 Hugoren Martinako 3392826 <NA> <NA>
#> 2          rombik97 9583643 <NA> <NA>
#>                                                           members
#> 1 426 members: node/21323935/admin_centre, way/1153082462/oute...
#> 2 1032 members: node/34105607/admin_centre, node/8000963555/la...
#>                                                                                  tags
#> 1 35 tags: admin_level=6 | alt_name:gl=Alacante | border_type=province | boundary=...
#> 2 54 tags: alt_name=País Valencià | alt_name:ca=País Valencià | boundary=political...