ropensci / osmdata

R package for downloading OpenStreetMap data
https://docs.ropensci.org/osmdata
316 stars 46 forks source link

[BUG] osmdata_sc doesn't work with doc parameter only #290

Closed jmaspons closed 1 year ago

jmaspons commented 1 year ago

Fails with https://github.com/ropensci/osmdata/pull/289/commits/7fde28a08dd0139cbc6d0199056d06c6bf371c15

library(osmdata)
#> Data (c) OpenStreetMap contributors, ODbL 1.0. https://www.openstreetmap.org/copyright
osm_multi <- test_path ("fixtures", "osm-multi.osm")
doc <- xml2::read_xml (osm_multi)
x_sc <- osmdata_sc (doc = doc)
#> bb_poly has more than one polygon; the first will be selected.
#> Error in bbox_to_string(obj) : bbox must be numeric

bbox is null because the query is missing. Other osmdata_* functions, work as expected.

jmaspons commented 1 year ago

Not fixed yet. An alternative to calculate bbox from the sc object is needed. Perhaps using getbb_sc in https://github.com/ropensci/osmdata/blob/0660e64946f5748def37e41fde45d223d494c1c6/R/get-osmdata-sc.R#L83