This function reprojects a geotrellis raster data gt_RasterLayer object to a new coordinate system. This function is similar to projectRaster.

# S4 method for gt_RasterLayer
gt_aggregate(x, fact, fun = c("mean", "mode",
  "median", "max", "min"))

# S4 method for gt_RasterLayer
gt_disaggregate(x, fact, method = c("ngb",
  "bilinear"))

gt_projectRaster(from, to, res, method)

# S4 method for gt_RasterLayer,CRS
gt_projectRaster(from, to, res,
  method = c("bilinear", "ngb"))

# S4 method for gt_RasterLayer,gt_RasterLayer
gt_projectRaster(from, to,
  method = c("bilinear", "ngb"))

Arguments

method
character method used to compute values for the new gt_RasterLayer. Either 'ngb' (nearest neighbor), which is useful for categorical variables, or 'bilinear' (bilinear interpolation; the default value), which is appropriate for continuous variables.
from
gt_RasterLayer object.
to
A gt_RasterLayer or CRS object with to reproject from to.
...
additional arguments.
res
numeric resolution to reproject the data to. This is required when to is a CRS object.

Value

gt_RasterLayer object.

Details

Note that--unlike projectRaster--this function does not have a to argument. Therefore users cannot specify a template projected raster to reproject a project gt_RasterLayer and ensure that the returned raster has a specific extent and dimensionality.

Examples

## Not run: ------------------------------------ # g <- gt_raster(raster::raster(matrix(runif(9), ncol=3), # crs=sp::CRS('+init=epsg:4326'), # xmn=0, xmx=3, ymn=2, ymx=10)) # result <- gt_projectRaster(g, sp::CRS('+init=epsg:3395'), res=50000, method='ngb') ## ---------------------------------------------