Skip to contents

Downloads and writes an NLCD SpatRaster to file with extents defined by template. This function downloads the annualized NLCD data products. See https://www.mrlc.gov/data/project/annual-nlcd for more information.

Usage

download_nlcd(
  template,
  year = "2021",
  dataset = "LndCov",
  landmass = "CU",
  output = tempfile(fileext = ".tiff"),
  overwrite = FALSE,
  verbose = FALSE,
  ...
)

Arguments

template

A SpatRaster object defining the spatial extent of the returned NLCD raster.

year

character, expects a value between 1986:2023.

dataset

Character. Expects c("LndCov","LndChg","LndCnf","FctImp","ImpDsc","SpcChg").

landmass

Character, one of: c("CU", "AK", "HI").

output

A character file path specifying where the raster file should be stored. Defaults to a temporary file.

overwrite

logical. If TRUE, filename is overwritten

verbose

Logical, if TRUE informative messages will be printed.

...

additional arguments for for writing files, see terra::writeRaster()

Value

A SpatRaster object with file written to output