Skip to contents

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

Usage

make_africa_mask(
  filename = NULL,
  type = c("raster", "vector"),
  res = c("high", "low"),
  countries = NULL
)

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.

Value

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

Details

Raster layers creates with extent of terra::ext(-18.0000019073486, 52.0416647593181, -34.9999987284343, 37.5416679382324)

Examples

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

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

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