Nothing
#' Save map layers to a file
#'
#' Write a list a map of layers to a geopackage file.
#' @param x a list of map layers produce with \code{om_get}
#' @param filename a geopackage file
#'
#' @returns The layers are saved to a geopackage file. Nothing is returned.
#' @export
#'
#' @examples
#' res = om_get(c(-61.070, 14.605), r = 600)
#' om_map(res, title = "Fort-de-France town centre")
#' (om_write(res, file.path(tempdir(), "f2f.gpkg")))
om_write = function(x, filename) {
if (tools::file_ext(filename) != "gpkg") {
stop("'filename' must be the path to a geopackage. It must end with '.gpkg'")
}
st_write(obj = x$zone, dsn = filename, layer = "zone", append = FALSE, quiet = TRUE)
st_write(obj = x$urban, dsn = filename, layer = "urban", append = FALSE, quiet = TRUE)
st_write(obj = x$building, dsn = filename, layer = "building", append = FALSE, quiet = TRUE)
st_write(obj = x$green, dsn = filename, layer = "green", append = FALSE, quiet = TRUE)
st_write(obj = x$road, dsn = filename, layer = "road", append = FALSE, quiet = TRUE)
st_write(obj = x$street, dsn = filename, layer = "street", append = FALSE, quiet = TRUE)
st_write(obj = x$railway, dsn = filename, layer = "railway", append = FALSE, quiet = TRUE)
st_write(obj = x$water, dsn = filename, layer = "water", append = FALSE, quiet = TRUE)
return(invisible(filename))
}
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.