
Remove a layer from map themes, leaving the layer in the project
Source:R/rfp_qgs_theme_layer.R
rfp_qgs_theme_layer_rm.RdThe inverse of rfp_qgs_theme_layer_add(), and deliberately not the same as
rfp_qgs_layer_rm(): the <maplayer>, its data and every other reference
stay. Only the theme's own entry goes, so the layer is still in the tree and
still reachable - it is simply hidden when this theme is applied.
Arguments
- qgs
Path to a
.qgsproject, or a directory holding exactly one.- layer
Character. Layer name(s) already in the project.
- themes
Character. Theme names, or
"all"for every theme in the project. A name the project does not have is an error - a caller naming a theme by hand has almost certainly typed it wrong.- backup
Logical. Write
<path>.bakbefore mutating. DefaultTRUE.
Examples
qgs <- file.path(tempdir(), "theme_layer_rm.qgs")
file.copy(system.file("testdata", "raster_add_fixture.qgs", package = "rfp"),
qgs, overwrite = TRUE)
#> [1] TRUE
rows <- rfp_qgs_themes(qgs)$layers
rfp_qgs_theme_layer_rm(qgs, rows$layer[[1]], themes = rows$theme[[1]],
backup = FALSE)
#> ✔ Removed 1 layer from 1 theme
unlink(qgs)