setExtent

0th

Percentile

Set the extent of a RasterLayer

setExtent sets the extent of a Raster* object. Either by providing a new Extent object or by setting the extreme coordinates one by one.

Keywords
spatial
Usage
setExtent(x, ext, keepres=FALSE, snap=FALSE)
extent(x) <- value
Arguments
x
A Raster* object
ext
An object of class Extent (which you can create with extent, or an object that has an extent (e.g. a Raster* or Spatial* object) )
keepres
logical. If TRUE, the resolution of the cells will stay the same after adjusting the bounding box (by adjusting the number of rows and columns). If FALSE, the number of rows and columns will stay the same, and the resolution
snap
logical. If TRUE, the extent is adjusted so that the cells of the input and output RasterLayer are aligned
value
An object of class Extent (which you can create with extent )
Value

  • a Raster* object

See Also

extent, Extent-class

Aliases
  • setExtent
  • extent<-
Examples
r <- raster()
bb <- extent(-10, 10, -20, 20)
extent(r) <- bb
r <- setExtent(r, bb, keepres=TRUE)
Documentation reproduced from package raster, version 2.1-41, License: GPL (>= 3)

Community examples

Looks like there are no examples yet.