This function resamples a geotrellis raster data gt_RasterLayer object to match the extent, resolution, and dimensionality of another projectRaster.

gt_resample(x, y, method)

# S4 method for gt_RasterLayer,gt_RasterLayer
gt_resample(x, y,
  method = c("bilinear", "ngb"))

Arguments

x
gt_RasterLayer object.
y
gt_RasterLayer object with parameters that x should be resampled to.
...
not used.
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.

Value

gt_RasterLayer object.

Details

This function is similar to resample.

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)) # template <- gt_raster(raster::raster(matrix(runif(4), ncol=2), # crs=sp::CRS('+init=epsg:4326'), # xmn=0, xmx=3, ymn=2, ymx=10)) # result <- gt_resample(g, template, method='bilinear') ## ---------------------------------------------