Skip to contents

Writes each layer returned by popmaps_rast() to a separate GeoTIFF. The function returns a small manifest containing the layer names and written file paths.

Usage

write_popmaps(
  pop_raster_list,
  input_raster,
  dir = ".",
  prefix = "popmaps",
  layer_names = NULL,
  overwrite = FALSE,
  ...
)

Arguments

pop_raster_list

A list returned by popmaps().

input_raster

The raster used to create pop_raster_list.

dir

Output directory for GeoTIFF files. Created if it does not exist.

prefix

File name prefix used for each layer.

layer_names

Optional character vector of layer names passed to popmaps_rast().

overwrite

Logical. If FALSE, the function stops before writing when any output file already exists.

...

Additional arguments passed to terra::writeRaster().

Value

A data frame with layer and path columns.

Examples

if (FALSE) { # \dontrun{
paths <- write_popmaps(aps, ex_raster, dir = "outputs", prefix = "hija")
} # }