Crop returns a geographic subset of an gt_RasterLayer
object as specified
by another gt_RasterLayer
object.
gt_crop(x, y) # S4 method for gt_RasterLayer,Extent gt_crop(x, y) # S4 method for gt_RasterLayer,gt_RasterLayer gt_crop(x, y)
gt_RasterLayer
object.Extent
or gt_RasterLayer
object.gt_RasterLayer
object.
This function is similar to crop
, except that y
must be a gt_RasterLayer
object and not just any Spatial
object.
## Not run: ------------------------------------ # g <- gt_raster(raster::raster(matrix(c(1:6), ncol=3), # crs=sp::CRS('+init=epsg:4326'), # xmn=0, xmx=3, ymn=2, ymx=10)) # ext <- extent(c(0, 3, 2, 6)) # result <- gt_crop(g, ext) ## ---------------------------------------------