Skip to content

Commit

Permalink
Warnings for ignored object editions (more than one element)
Browse files Browse the repository at this point in the history
Point to osmchange_*() + osm_diff_upload_changeset()
  • Loading branch information
jmaspons committed May 17, 2024
1 parent 6277909 commit c50fdb1
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions R/osmapi_elements.R
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,12 @@ osm_create_object <- function(x, changeset_id) {
rm_path <- TRUE
}

if (length(xml2::xml_children(xml)) > 1L) {
warning(
"Multiple elements are provided, but only the first is created. Use `osmchange_create()` + ",
"`osm_diff_upload_changeset()` to efficiently create more than one object."
)
}
osm_type <- xml2::xml_name(xml2::xml_child(xml))

if (length(osm_type) > 1) {
Expand Down Expand Up @@ -354,6 +360,13 @@ osm_update_object <- function(x, changeset_id) {
rm_path <- TRUE
}

if (length(xml2::xml_children(xml)) > 1L) {
warning(
"Multiple elements are provided, but only the first is updated. Use `osmchange_modify()` + ",
"`osm_diff_upload_changeset()` to efficiently update more than one object."
)
}

osm_type <- xml2::xml_name(xml2::xml_child(xml))
osm_id <- xml2::xml_attr(xml2::xml_child(xml), "id")

Expand Down Expand Up @@ -490,6 +503,13 @@ osm_delete_object <- function(x, changeset_id) {
rm_path <- TRUE
}

if (length(xml2::xml_children(xml)) > 1L) {
warning(
"Multiple elements are provided, but only the first is deleted. Use `osmchange_delete()` + ",
"`osm_diff_upload_changeset()` to efficiently delete more than one object."
)
}

osm_type <- xml2::xml_name(xml2::xml_child(xml))
osm_id <- xml2::xml_attr(xml2::xml_child(xml), "id")

Expand Down

0 comments on commit c50fdb1

Please sign in to comment.