raster (version 1.0.4)

alignExtent: Align an extent (object of class Extent)

Description

AlignExtent aligns an extent (Extent object) with the cells of a Raster* object

Usage

alignExtent(extent, object)

Arguments

extent
An object of class Extent (which you can create with newExtent() )
object
A Raster* object

Value

  • a object of class Extent

Details

Aligning extents assures that the two extents have 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 resample, (dis)aggregate for this).

See Also

extent, drawExtent, Extent-class

Examples

Run this code
r <- raster()
bb <- extent(-10.1, 10.1, -20.1, 20.1)
bba <- alignExtent(bb, r)
bb
extent(r)
bba

Run the code above in your browser using DataCamp Workspace