Learn R Programming

satellite (version 1.0.5)

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

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

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

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

Value

Satellite object with aligned geometries.

raster::RasterStack object with aligned layers

raster::RasterLayer object with aligned layer

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.

Examples

Run this code
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")

Run the code above in your browser using DataLab