Skip to contents

Prepare data to update tags, members and/or latitude and longitude.

Usage

osmchange_modify(
  x,
  tag_keys,
  members = FALSE,
  lat_lon = FALSE,
  format = c("R", "osc", "xml")
)

Arguments

x

A osmapi_objects with the columns type and id with unique combinations of values plus columns specifying tags, members or latitude and longitude.

tag_keys

A character vector with the keys of the tags that will be modified. If missing (default), all tags will be updated, removed or created. If FALSE, don't modify tags.

members

If TRUE and x has a members column, update the members of the ways and relations objects.

lat_lon

If TRUE and x has a lat and lon columns, update the coordinates of the node objects.

format

Format of the output. Can be "R" (default), "osc" ("xml" is a synonym for "osc").

Value

If format = "R", returns a osmapi_OsmChange data frame with one OSM edition per row. If format = "osc" or format = "xml", returns a xml2::xml_document following the OsmChange format that can be saved with xml2::write_xml() and opened in other applications such as JOSM.

The results are ready to send the editions to the servers with osm_diff_upload_changeset().

Details

x should be a osmapi_objects or follow the same format. Missing tags or tags with NA in the value will be removed if tag_keys is not specified. See osm_get_objects() for examples of the format.

See also

Examples

if (FALSE) {
obj <- osm_get_objects(
  osm_type = c("node", "way", "way", "relation", "relation", "node"),
  osm_id = c("35308286", "13073736", "235744929", "40581", "341530", "1935675367"),
  version = c(1, 3, 2, 5, 7, 1) # Old versions
)
osmch <- osmchange_modify(obj)
osmch
}