-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Add parameters from oqp
to opq_osm_id
#320
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for thinking of that. This is a really cool expansion, but still needs a bit of work to reconciile the kinds of behaviour illustrated in these couple of reprexes.
devtools::load_all (".", export_all = TRUE)
#> ℹ Loading osmdata
#> Data (c) OpenStreetMap contributors, ODbL 1.0. https://www.openstreetmap.org/copyright
id <- 142107768 # Boundary of Bois de Vincennes, Paris: way
x0 <- opq_osm_id (type = "way", id = id) |>
opq_string () |>
osmdata_sf ()
n0 <- nrow (x0$osm_points)
dt0 <- "2013-01-01T00:00:00Z"
dt2 <- "2023-03-15T00:00:00Z"
# Expect fewer points in 2013 than 2023:
x1 <- opq_osm_id (type = "way", id = id, datetime = dt0) |>
opq_string () |>
osmdata_sf ()
n1 <- nrow (x1$osm_points)
n1 < n0
#> [1] TRUE
# Uninformative error message: should direct people to use
# `osmdata_data_frame()`:
x <- opq_osm_id (type = "way", id = id, datetime = dt0, datetime2 = dt2, adiff = TRUE) |>
opq_string () |>
osmdata_sf ()
#> Error in check_not_implemented_queries(obj): adiff queries not yet implemented.
# This is then okay:
x <- opq_osm_id (type = "way", id = id, datetime = dt0, datetime2 = dt2, adiff = TRUE) |>
opq_string () |>
osmdata_data_frame ()
nrow (x) < n1
#> [1] TRUE
Created on 2023-03-15 with reprex v2.0.2
Plus then these illustrations of error and warning messages that need to be improved:
devtools::load_all (".", export_all = TRUE)
#> ℹ Loading osmdata
#> Data (c) OpenStreetMap contributors, ODbL 1.0. https://www.openstreetmap.org/copyright
id <- 7444 # Boundary of Paris, France: relation
# This error message is uninformative, and should direct people to use
# 'osmdata_data_frame()':
x <- opq_osm_id (type = "relation", id = id, out = "tags") |>
opq_string () |>
osmdata_sf ()
#> Error in check_not_implemented_queries(obj): Queries returning no geometries
#> (out tags/ids) not accepted. Use queries with `out="body"` or `out="skel"` instead.
# This then works as expected
x <- opq_osm_id (type = "relation", id = id, out = "tags") |>
opq_string () |>
osmdata_data_frame ()
# Same here: the warning (okay in this case), should also direct people to use
# `osmdata_data_frame()`:
x <- opq_osm_id (type = "relation", id = id, out = "meta") |>
opq_string () |>
osmdata_sf ()
#> Warning in check_not_implemented_queries(obj): `out meta` queries not yet
#> implemented. Metadata fields will be missing.
# Which again works as expected:
x <- opq_osm_id (type = "relation", id = id, out = "meta") |>
opq_string () |>
osmdata_data_frame ()
Created on 2023-03-15 with reprex v2.0.2
Hi and thanks for the feedback, @mpadge! My assumption for the text of the messages is that people using |
Yeah, sorry, I should have explained better, but that was exactly what I meant. Just adding some extra information to current errors/warnings. |
I improved the messages, @mpadge. Ready to merge now? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, that's much better, thanks
No description provided.