R: Crop Satellite object

crop {satellite} | R Documentation

## 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 signature 'Satellite'
    crop(x, y, subset = TRUE, snap = "near")

### 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.

### Value

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

### References

Please refer to the respective functions for references.

### See Also

This function is a wrapper for `raster::crop`.

### Examples

    ## Not run:
    ## 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)

    ## End(Not run)

[Package satellite version 1.0.1 Index]