R: Align raster geometry between two data sets

alignGeometry {satellite} | R Documentation

## Align raster geometry between two data sets

### Description

Align raster data by bringing it in the same geometry and extent. If the data set is not in the same projection as the template, the alignment will be computed by reprojection. If the data has already the same projection, the data set will be cropped and aggregated prior to resampling in order to reduce computation time.

### Usage

    ## S4 method for signature 'Satellite'
    alignGeometry(x, template, band_codes, type,
      method = c("bilinear", "ngb"))

    ## S4 method for signature 'RasterStack'
    alignGeometry(x, template, method = c("bilinear",
      "ngb"))

    ## S4 method for signature 'RasterLayer'
    alignGeometry(x, template, method = c("bilinear",
      "ngb"))

### Arguments

`x` | Satellite or Raster* object to be resampled.
`template` | Raster* or spatial data set from which geometry can be extracted.
`band_codes` | Band ID(s) to be resampled. If not supplied and type is not given, too, all bands will be considered for resampling.
`type` | Type of bands (e.g. VIS, NIR) which should be considered. If not supplied, all types will be processed depending and bands to be processed can be defined by band_codes.
`method` | Method for resampling; "bilinear" for bilinear interpolation (default) or "ngb" for nearest neighbor interpolation. See e.g. `resample`, `projectRaster`.

### Value

Satellite object with aligned geometries.

raster::RasterStack object with aligned layers

raster::RasterLayer object with aligned layer

### Examples

    path <- system.file("testdata/LC8", package = "satellite")
    files <- list.files(path, pattern = glob2rx("LC8*.TIF"), full.names = TRUE)
    sat <- satellite(files)

    alignGeometry(sat, template = getSatDataLayer(sat, "B008n"),
                   band_codes = "B001n")

[Package satellite version 1.0.1 Index]