osmchange_modify {osmapiR}R Documentation

osmchange to modify existing OSM objects

Description

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").

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.

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().

See Also

Other OsmChange's functions: osm_diff_upload_changeset(), osm_download_changeset(), osmchange_create(), osmchange_delete()

Examples

## Not run: 
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

## End(Not run)

[Package osmapiR version 0.1.0 Index]