This function creates a raster layer that adopts values from a defined field
in a polygon layer, using rasterize from the raster package. This
function also converts values to binary if desired, where all zero values
are recorded as zero, and all non-zero values are recorded as one. This
function also saves the output raster in the working directory.
gs_rasterize(input_features, output_raster, template_raster,
binary = FALSE, field = "ID", overwrite = FALSE,
format = "GTiff")SpatialPolygons* object. Name of input shapefile layer. Should be a SpatialPolygons object.
Character. Desired name of output raster layer.
Raster* object. Raster with desired characteristics (resolution, extent) of output raster.
logical. If TRUE, any non-zero values will be converted
to one.
character. Name of variable that output raster should inherit.
logical. Defines whether to overwrite if
output_raster already exists.
character. Desired format of output raster file.
Vector of values representing the stratum that occurs most often within a given subset of the raster.