Learn R Programming

raster (version 1.8-3)

alignExtent: Align an extent (object of class Extent)

Description

Align an Extent object with the cells of a Raster* object

Usage

alignExtent(extent, object)

Arguments

extent
An object of class Extent
object
A Raster* object

Value

  • a object of class Extent

Details

Aligning an Extent object to another object assures that it gets the same origin and resolution. This should only be used to adjust objects because of imprecision in the data. alignExtent should not be used to force data to match that really does not match (use e.g. resample or (dis)aggregate for this).

See Also

extent, drawExtent, Extent-class

Examples

Run this code
r <- raster()
e <- extent(-10.1, 10.1, -20.1, 20.1)
ea <- alignExtent(e, r)
e
extent(r)
ea

Run the code above in your browser using DataLab