rasterize_range: Rasterize species range

View source: R/rasterize_range.R

rasterize_rangeR Documentation

Rasterize species range

Description

Rasterize a species' range, either by burning points directly into raster, or by calculating an alpha hull around points and burning the hull into raster.

Usage

rasterize_range(
  xy,
  method,
  alpha,
  point_buffer = 0,
  template,
  outfile,
  xy_crs,
  plot = TRUE
)

Arguments

xy

Coordinates to define host/species' range. This must be one of: a matrix with two columns giving longitude and latitude (in that order); a file path to a csv file that contains columns "Longitude" and "Latitude"; a SpatialPoints object; or a sf multipoints object. Points will be reduced to the subset that falls within the template extent.

method

Either points to burn xy points into raster, or alphahull to calculate the alpha hull of xy, and burn those polygons into raster.

alpha

Alpha parameter for alpha hull calculation. Ignored if method is 'points'.

point_buffer

When method = "points", the width of a buffer to generate around xy points before burning into the raster. Expected to be in the CRS of template. Ignored if method is 'alphahull'.

template

RasterLayer or file path to raster file. The host raster resulting from this function will use the extent and resolution of this template.

outfile

Optional file path to write out resulting host raster.

xy_crs

Coordinate reference system of xy, passed as numeric EPSG code, or any other format accepted by sf::st_set_crs(). If missing and xy is an sp or sf object, the CRS is defined by the object. If the latter is undefined, or if xy_crs is missing and xy is a matrix or path to a csv file, xy will inherit the CRS of template, and if that is undefined, EPSG:4326 (WGS84) will be assumed. If xy_crs is provided and xy is an sf or sp object with a defined CRS, xy_crs will be ignored.

plot

Logical. Plot the resulting raster? Default = TRUE.

Value

A RasterLayer with the resulting range burnt into it. Additionally, if outfile is not missing, the raster is written to that file.


jscamac/edmaps documentation built on June 11, 2022, 1:26 a.m.