Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

projectRaster

Project a RasterArray object


Description

The method implemets the projectRaster function for RasterArray class objects.

Usage

projectRaster(
  from,
  to,
  res,
  crs,
  method = "bilinear",
  alignOnly = FALSE,
  over = FALSE,
  filename = "",
  ...
)

## S4 method for signature 'RasterArray'
projectRaster(
  from,
  to,
  res,
  crs,
  method = "bilinear",
  alignOnly = FALSE,
  over = FALSE
)

Arguments

from

A Raster* RasterArray object to project.

to

Raster* object with the parameters to which 'from' should be projected

res

single or (vector of) two numerics. To, optionally, set the output resolution if 'to' is missing

crs

character or object of class 'CRS'. PROJ.4 description of the coordinate reference system. In projectRaster this is used to set the output CRS if 'to' is missing, or if 'to' has no valid CRS

method

method used to compute values for the new RasterLayer. Either 'ngb' (nearest neighbor), which is useful for categorical variables, or 'bilinear' (bilinear interpolation; the default value), which is appropriate for continuous variables.

alignOnly

logical. Use to or other parameters only to align the output (i.e. same origin and resolution), but use the projected extent from from

over

logical. If TRUE wrapping around the date-line is turned off. This can be desirable for global data (to avoid mapping the same areas twice) but it is not desireable in other cases

filename

character output filname. Not applicable for RasterArray class objects.

...

additional arguments as for writeRaster.

Value

A projected RasterArray class object.

Examples

# project first three to mollweide
data(dems)
suppressWarnings(
  mollDem <- projectRaster(dems[1:3], crs=CRS("+proj=moll"))
)

chronosphere

Earth System History Variables

v0.4.1
CC BY 4.0
Authors
Adam T. Kocsis, Nussaibah B. Raja
Initial release
2021-04-16

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.