Learn R Programming

satellite (version 0.1.0)

alignGeometry: 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

## S3 method for class 'Satellite':
alignGeometry(x, template, band_codes, type,
  method = c("bilinear", "ngb"))

## S3 method for class 'RasterStack': alignGeometry(x, template, method = c("bilinear", "ngb"))

## S3 method for class '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 alligned geometries.

    raster::RasterStack object with alligned layers

    raster::RasterLayer object with alligned layer

Examples

Run this code
path <- system.file("extdata", 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")

Run the code above in your browser using DataLab