Learn R Programming

amadeus (version 1.2.2)

calculate_nlcd: Calculate land cover covariates

Description

Compute ratio of land cover class in circle buffers around points. Returns a data.frame object containing locs_id, longitude, latitude, time (year), and computed ratio for each land cover class.

Usage

calculate_nlcd(
  from,
  locs,
  locs_id = "site_id",
  mode = c("exact", "terra"),
  radius = 1000,
  max_cells = 5e+07,
  geom = FALSE,
  ...
)

Value

a data.frame or SpatVector object

Arguments

from

SpatRaster(1). Output of process_nlcd().

locs

terra::SpatVector of points geometry

locs_id

character(1). Unique identifier of locations

mode

character(1). One of "exact" (using exactextractr::exact_extract()) or "terra" (using terra::freq()).

radius

numeric (non-negative) giving the radius of buffer around points

max_cells

integer(1). Maximum number of cells to be read at once. Higher values may expedite processing, but will increase memory usage. Maximum possible value is 2^31 - 1. Only valid when mode = "exact". See exactextractr::exact_extract for details.

geom

FALSE/"sf"/"terra".. Should the function return with geometry? Default is FALSE, options with geometry are "sf" or "terra". The coordinate reference system of the sf or SpatVector is that of from.

...

Placeholders.

See Also

process_nlcd

Examples

Run this code
## NOTE: Example is wrapped in `\dontrun{}` as function requires a large
##       amount of data which is not included in the package.
if (FALSE) {
loc <- data.frame(id = "001", lon = -78.90, lat = 35.97)
calculate_nlcd(
  from = nlcd, # derived from process_nlcd() example
  locs = loc,
  locs_id = "id",
  mode = "exact",
  geom = FALSE
)
}

Run the code above in your browser using DataLab