Learn R Programming

satellite (version 1.0.5)

crop: Crop Satellite object

Description

The function is a wrapper around the crop function to easily crop a Satellite object by an extent object.

Usage

# S4 method for Satellite
crop(x, y, subset = TRUE, snap = "near")

Value

A Satellite object consisting of cropped layers only. If subset = FALSE, a Satellite object with the cropped layers appended.

Arguments

x

Satellite object.

y

extent object.

subset

Logical; if TRUE (default), all layers but the cropped ones are being dropped; if FALSE, cropped layers are appended to the Satellite object.

snap

Direction towards which to align the extent as character. Available options are "near" (default), "in" and "out" (see alignExtent).

Details

Crop layers of a Satellite object to the size of a given raster::extent object.

References

Please refer to the respective functions for references.

See Also

This function is a wrapper for raster::crop.

Examples

Run this code
if (FALSE) {
## sample data
path <- system.file("extdata", package = "satellite")
files <- list.files(path, pattern = glob2rx("LC08*.TIF"), full.names = TRUE)
sat <- satellite(files)

## geographic extent of georg-gassmann-stadium (utm 32-n)
ext_ggs <- raster::extent(484015, 484143, 5627835, 5628020)

## crop satellite object by specified extent
sat_ggs <- crop(sat, ext_ggs)

plot(sat)
plot(sat_ggs)
}

Run the code above in your browser using DataLab