The {camtrapmonitoring} package provides functions for planning and evaluating camera trap surveys. The recommended approach is to first sample a set of candidate camera trap locations larger than the intended number of locations. Next, these candidate locations are evaluated using spatial layers to measure their deployment feasibility (such as distance to road) and to quantify their bias and coverage of project-specific characteristics (such as distribution across specific land cover classes).
{camtrapmonitoring} is designed to work with modern spatial R packages: {sf} and {terra}.
library(camtrapmonitoring)
library(sf)
#> Linking to GEOS 3.12.1, GDAL 3.8.4, PROJ 9.4.0; sf_use_s2() is TRUE
library(terra)
#> terra 1.9.27The sample_ct function returns candidate camera trap
locations using sf::st_sample across the user’s region of
interest. Options include “regular”, “random” or “hexagonal” sampling
across the entire region of interest or stratified by a column in the
provided features.
The example data “clearwater_lake_density” is a simulated species density grid near Clearwater Lake, Manitoba. It is a simple feature collection of polygons with a column named “density” (High, Medium, Low).
We will randomly sample candidate camera trap locations, stratified by the simulated species density.
pts <- sample_ct(
region = clearwater_lake_density,
n = 25,
type = 'random',
strata = 'density'
)
plot(pts)To evaluate candidate camera trap locations, determine each spatial layer required and the criteria associated with it. For example:
Deployment feasibility
Characteristics of candidate locations
First, we will evaluate the deployment feasibility layers. Note the example elevation data is an external TIF file that can be loaded with the {terra} package.
The eval_* family of functions return a vector of values
for each candidate camera trap location. These vectors can be added to
the simple features objects using the base R
df$name <- value syntax (shown here) or with
dplyr::mutate. eval_* functions take
‘features’ (candidate camera trap locations) and a ‘target’ covariate to
evaluate each candidate location with. For eval_pt and
eval_buffer, ‘target’ covariates are expected to be raster
layers while eval_dist expects a ‘target’ vector
object.
# Load data
clearwater_lake_elevation_path <- system.file('extdata', 'clearwater_lake_elevation.tif', package = 'camtrapmonitoring')
clearwater_lake_elevation <- rast(clearwater_lake_elevation_path)
data("clearwater_lake_roads")
# Evaluate elevation using point sample
pts$elev_pt <- eval_pt(features = pts, target = clearwater_lake_elevation)
# Evaluate elevation using buffered point sample
pts$elev_buffer_1e3 <- eval_buffer(
features = pts,
target = clearwater_lake_elevation,
buffer_size = 1e3
)
# Evaluate distance to roads
pts$road_dist <- eval_dist(features = pts, target = clearwater_lake_roads)
# Plot results
plot(pts)Next, we will evaluate the characteristics of candidate locations. Note the example land cover data is an external TIF file that can be loaded with the {terra} package.
# Load data
clearwater_lake_land_cover_path <- system.file('extdata', 'clearwater_lake_land_cover.tif', package = 'camtrapmonitoring')
clearwater_lake_land_cover <- rast(clearwater_lake_land_cover_path)
data("clearwater_lake_hydro")
data("clearwater_lake_wetlands")
# Evaluate land cover using point sample
pts$lc_pt <- eval_pt(features = pts, target = clearwater_lake_land_cover)
# Evaluate distance to hydrology
pts$hydro_dist <- eval_dist(features = pts, target = clearwater_lake_hydro)
# Evaluate distance to wetland
pts$wetland_dist <- eval_dist(features = pts, target = clearwater_lake_wetlands)
# Plot results
plot(pts)To select camera trap locations, define the criteria for selecting and sorting candidate locations.
Criteria for selection:
Criteria for sorting:
# Selection criteria
max_road_dist_m <- 3000
max_elev_m <- 300
ls_lc_classes <- c(1, 2, 5, 6)
# Select out of candidate points
select_pts <- pts[pts$road_dist < max_road_dist_m &
pts$elev_pt < max_elev_m &
pts$lc_pt %in% ls_lc_classes,]
plot(select_pts)# Sorting criteria
ordered <- order(select_pts$wetland_dist, -select_pts$hydro_dist)
order_select_pts <- select_pts[ordered,]
print(order_select_pts)
#> Simple feature collection with 15 features and 8 fields
#> Geometry type: POINT
#> Dimension: XY
#> Bounding box: xmin: 344363.4 ymin: 5976493 xmax: 377600.5 ymax: 6001975
#> Projected CRS: WGS 84 / UTM zone 14N
#> First 10 features:
#> density geometry id_sample_ct elev_pt elev_buffer_1e3
#> 36 Medium POINT (377600.5 5992030) 36 264 264.8380
#> 49 Medium POINT (377096.1 5991643) 49 263 263.8679
#> 74 Low POINT (353779.5 5997573) 74 282 282.8057
#> 45 Medium POINT (348614 5990408) 45 288 282.5515
#> 35 Medium POINT (353696.9 5983666) 35 264 265.5153
#> 38 Medium POINT (377400.4 5986318) 38 265 264.9149
#> 3 High POINT (344363.4 6001975) 3 279 279.8194
#> 50 Medium POINT (361796.9 5980366) 50 263 265.5807
#> 37 Medium POINT (362093 5980349) 37 266 265.5359
#> 57 Low POINT (363074.9 5981107) 57 264 265.7329
#> road_dist lc_pt hydro_dist wetland_dist
#> 36 1955.1602 5 1768.739 1590.286
#> 49 1420.9685 1 1138.621 1819.701
#> 74 2618.8315 1 2093.007 2870.618
#> 45 1656.2087 1 7061.609 3653.424
#> 35 1431.1199 1 2552.657 4837.155
#> 38 601.0694 6 1655.448 7144.260
#> 3 905.9714 1 4962.171 10932.210
#> 50 2549.8417 1 2887.310 11627.227
#> 37 2442.9066 1 2931.390 11851.189
#> 57 1520.9493 5 2368.485 12101.800The function grid_ct allows the user to establish
sampling grids around focal locations selected above. The
grid_design function is provided to the user to help
explore grid layout options, using either the ‘case’ argument or the ‘n’
argument.
After the grid design is selected, the grid_ct function
can be used with the selected camera trap locations.
ct_grids <- grid_ct(
features = order_select_pts,
distance = 500,
case = 'queen'
)
plot(ct_grids['id_grid_ct'][1])Example data used in the {camtrapmonitoring} package come from open data sources we gratefully acknowledge in the help page for each data set. Also see the “data-raw” directory in the package source for full data preprocessing steps.
?clearwater_lake_density?clearwater_lake_elevation?clearwater_lake_hydro?clearwater_lake_land_cover?clearwater_lake_roads