initialise_raster: Create an empty raster

View source: R/initialise_raster.R

initialise_rasterR Documentation

Create an empty raster

Description

Create an empty or constant raster with specified attributes.

Usage

initialise_raster(
  x,
  outfile,
  extent,
  res,
  crs,
  init = NA,
  datatype = "FLT4S",
  overwrite = TRUE,
  return_rast = FALSE
)

Arguments

x

Optional. Raster* object or a file path to template raster. If this is provided, extent, res, and crs will be taken from this raster unless they are also passed to this function. If x is not provided, then extent and res must be provided.

outfile

Target raster file path. Directory will be created (recursively) if it doesn't exist.

extent

Either a character path to a raster file, an Extent object (or an object from which such an extent can be extracted), or a numeric vector with four elements giving xmin, xmax, ymin, ymax.

res

Numeric or integer vector giving the horizontal and vertical spatial resolution of the target raster, in units of crs. If a single value is given, it will be used for both horizontal and vertical resolution.

crs

Target coordinate reference system as a PROJ string (character) or an object of class CRS. If missing and x is supplied, the crs of x will be used.

init

Numeric. A value assigned to all cells of the created raster.

datatype

Character. Data type for the created raster. See raster::dataType().

overwrite

Logical. Should outfile be overwritten if it exists?

return_rast

Logical. Should the resulting raster be returned?

Value

An empty raster is created at outfile, and the corresponding RasterLayer is returned if return_rast is TRUE.


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