Skip to contents

The 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.

Usage

rfp_qgs_theme_layer_rm(qgs, layer, themes = "all", backup = TRUE)

Arguments

qgs

Path to a .qgs project, 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>.bak before mutating. Default TRUE.

Value

Invisibly, a data frame of theme, layer, action ("removed" or "absent").

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)