Skip to contents

Makes a SpatRaster or SpatVector mask layer of countries, based on shapefiles for from the malaraAtlas package.

Usage

make_mask(
  filename = NULL,
  type = c("raster", "vector"),
  res = c("high", "low"),
  countries = NULL,
  overwrite = FALSE
)

Arguments

filename

Character of file path and name if mask is to be written to disc.

type

Character raster or vector; to return mask as either SpatRaster or SpatVector.

res

Character "high" or "low"; corresponding to resolution of 0.008333333 or 0.04166667 decimal degrees

countries

Character of ISO3 country names. If NULL returns all countries in Africa.

overwrite

logical

Value

SpatRaster or SpatVector in WGS 84 (EPSG:4326).

standard usage make_mask(filename = NULL, type = c("raster",

"vector"), res = c("high", "low"), countries = NULL)

make_africa_mask is deprecated, and is intended for backward compatibility. It is a simple alias for make_mask: make_africa_mask(filename = NULL, type = c("raster", "vector"), res = c("high", "low"), countries = NULL)

make_vector_mask sets type = "vector": make_mask(filename = NULL, type = "vector", res =' c("high", "low"), countries = NULL)

Examples

if (FALSE) { # \dontrun{
# Create an object in workspace
africa_mask_v <- make_mask(type = "vector")

# Save to disk
make_mask(filename = "africa_mask.tif", type = "raster")

# or do both at once
africa_mask_r <- make_africa_mask("africa_mask.tif")
} # }