Skip to contents

Using buffered camera trap locations generated with camtrapmonitoring functions sample_ct() and grid_ct(), sample raster layers to characterize and select camera trap locations, and quantify potential sampling bias.

Usage

eval_buffer(features, target, buffer_size, buffer_fun = mean, layer = 1)

Arguments

features

sf features (see sf::st_sf())

target

SpatRaster target (see terra::rast())

buffer_size

radius of buffer around each point

buffer_fun

function for summarizing buffer region, default mean

layer

default 1, see terra::extract()

Value

vector of values from target matching buffered locations in features

See also

Other eval: eval_dist(), eval_pt()

Examples

library(terra)

data("clearwater_lake_density")
clearwater_lake_elevation <- rast(system.file('extdata',
  'clearwater_lake_elevation.tif', package = 'camtrapmonitoring'))

# Sample points
pts <- sample_ct(region = clearwater_lake_density, 1, type = 'random')

# Make grid with queen's case
queen <- grid_ct(features = pts, case = 'queen', distance = 100)

# Evaluate each point with the land cover layer
queen$elev <- eval_buffer(
  features = queen, target = clearwater_lake_elevation, buffer_size = 150)

plot(queen["elev"])