ropensci/osmdata

How to join sc object together ?

xtimbeau opened this issue · 2 comments

Hi, thanks for this package. I am trying to build up a silicate extract of some OSM data to be used in dodgr. I used the vignette "splitting large queries" but I fail to do the final merge. There seems to be no method for c for SC or osmdata_sc class. Am I missing something ?

mpadge commented

Thanks @xtimbeau, you were right that we had neglected to implement the c.osmdata_sc method. The above commit does that, and you should now be able to do this:

library (osmdata)
#> Data (c) OpenStreetMap contributors, ODbL 1.0. https://www.openstreetmap.org/copyright
packageVersion ("osmdata")
#> [1] '0.2.5.4'

x1 <- opq (bbox = "maldon australia") |>
    add_osm_feature (key = "natural") |>
    osmdata_sc ()
x2 <- opq (bbox = "maldon australia") |>
    add_osm_feature (key = "leisure") |>
    osmdata_sc ()

x12 <- c (x1, x2)

sapply (x1, nrow)
#>               nodes    relation_members relation_properties              object 
#>                 347                  13                  13                 287 
#>    object_link_edge                edge              vertex                meta 
#>                3190                3190                3450                   1
sapply (x2, nrow)
#>               nodes    relation_members relation_properties              object 
#>                   2                   4                  26                 148 
#>    object_link_edge                edge              vertex                meta 
#>                 591                 591                 576                   1
sapply (x12, nrow)
#>               nodes    relation_members relation_properties              object 
#>                 349                  17                  39                 432 
#>    object_link_edge                edge              vertex                meta 
#>                3781                3781                3984                   1

Created on 2023-10-06 with reprex v2.0.2