BackgroundBuffers: Create buffers for spatially-constrained background point...

View source: R/BackgroundBuffers.R

BackgroundBuffersR Documentation

Create buffers for spatially-constrained background point generation

Description

This function takes a list of occurrence point files and generates buffer shapefiles around each set of points. These buffers will be used if spatially-constrained background points are required. The radius of the buffer can be defined as a single value for all species or as a distinct value for each species. If no radius values are given, the distances between the occurrence points themselves inform the buffer radius (see buff_distance).

Usage

BackgroundBuffers(occlist, envdata, output, buff_distance = NA, ncores = 1)

Arguments

occlist

a list of .csv files containing the occurrence points for all species intending to be modelled. Either the complete occurrence data or the subsampled data may be used although results may vary depending on which data set is used. The files should be named the same as the taxon of interest (e.g.,: ".../Canis_lupus.csv"), and should be in the same coordinate reference system as the projected environmental data (see megaSDM::OccurrenceManagement).

envdata

a SpatRaster or list of raster files corresponding to the training region (the region the SDM model(s) will be trained on). This provides the CRS arguments to project the created buffer shapefiles.

output

the full path to the directory where the buffer shapefiles will be written out to. It is recommended that this is a unique directory from the one background points will be written to.

buff_distance

how wide should the buffers be around the occurrence points? If a single number is given, buffers for all species will have a radius of that number in map units. Buffers for longlat projection should be given in meters. If you are unsure what spatial units the data have, run terra::linearUnits() on envdata, which will give 0 if units are in degrees, or a number corresponding to the number of meters within one map unit (e.g., map units of km will have 1000). If a vector of the same length as occlist is given, the buffer radius for each species will correspond to the matching value in the vector. Finally, if set to NA (default), 2*the 95% quantile of the minimum distance between each point is taken as the radius.

ncores

the number of computer cores to parallelize the background point generation on. Default is 1; Using one fewer core than the computer has is usually optimal.

Value

shapefiles (.shp) that are buffers around the occurrence points of each species are written out to the directory indicated by the output argument. Also prints a .csv file for each species containing the width of the buffer in the projection units.


brshipley/megaSDM documentation built on Nov. 26, 2024, 6:08 a.m.