new_map_manager: New map manager

View source: R/class_MapManager.R

new_map_managerR Documentation

New map manager

Description

Create a new MapManager object.

Usage

new_map_manager(layers, order = rev(seq_along(layers)))

Arguments

layers

list of Theme and/or Weight objects.

order

numeric vector containing a value for each element in layers. These values indicate the order each layer should appear on them map. A value of 1 indicates that a layer should appear beneath every other layer. Defaults to an integer sequence of numbers based on the number of elements in layers.

Value

A MapManager object.

Examples

# create dataset
# find data file paths
f1 <- system.file(
  "extdata", "projects", "sim_raster", "sim_raster_spatial.tif",
  package = "wheretowork"
)
f2 <- system.file(
  "extdata",  "projects", "sim_raster", "sim_raster_attribute.csv.gz",
  package = "wheretowork"
)
f3 <- system.file(
  "extdata",  "projects", "sim_raster", "sim_raster_boundary.csv.gz",
  package = "wheretowork"
)

# create new dataset
d <- new_dataset(f1, f2, f3)

# create variables
v1 <- new_variable_from_auto(dataset = d, index = 1)
v2 <- new_variable_from_auto(dataset = d, index = 2)
v3 <- new_variable_from_auto(dataset = d, index = 3)
v4 <- new_variable_from_auto(dataset = d, index = 4)

# create a weight using a variable
w <- new_weight(
  name = "Human Footprint Index", variable = v1,
  factor = -90, status = FALSE, id = "W1"
)

# create features using variables
f1 <- new_feature(
  name = "Possum", variable = v2,
  goal = 0.2, status = FALSE, current = 0.5, id = "F1"
)
f2 <- new_feature(
  name = "Forests", variable = v3,
  goal = 0.3, status = FALSE, current = 0.9, id = "F2"
)
f3 <- new_feature(
  name = "Shrubs", variable = v4,
  goal = 0.6, status = TRUE, current = 0.4, id = "F3"
)

# create themes using the features
t1 <- new_theme("Species", f1, id = "T1")
t2 <- new_theme("Ecoregions", list(f2, f3), id = "T2")

# create a map manager for the themes and weight
mm <- new_map_manager(layers = list(t1, t2, w))

# print object
print(mm)

NCC-CNC/wheretowork documentation built on Feb. 27, 2025, 6:11 p.m.