osmchange_create | R Documentation |
osmchange
to create OSM objectsPrepare data to create OSM objects.
osmchange_create(x, format = c("R", "osc", "xml"))
x |
A osmapi_objects with columns |
format |
Format of the output. Can be |
Objects IDs are unknown and will be allocated by the server. If id
column is missing in x
, a negative
placeholders will be used. Check OsmChange page for details about
how to refer to objects still not created to define the members of relations and nodes of ways.
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()
.
Other OsmChange's functions:
osm_diff_upload_changeset()
,
osm_download_changeset()
,
osmchange_delete()
,
osmchange_modify()
d <- data.frame(
type = c("node", "node", "way", "relation"),
id = -(1:4),
lat = c(0, 1, NA, NA),
lon = c(0, 1, NA, NA),
name = c(NA, NA, "My way", "Our relation"),
type.1 = c(NA, NA, NA, "Column clash!")
)
d$members <- list(
NULL, NULL, -(1:2),
matrix(
c("node", "-1", NA, "node", "-2", NA, "way", "-3", "outer"),
nrow = 3, ncol = 3, byrow = TRUE, dimnames = list(NULL, c("type", "ref", "role"))
)
)
obj <- osmapi_objects(d, tag_columns = c(name = "name", type = "type.1"))
osmcha <- osmchange_create(obj)
osmcha
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.