stackMeta | R Documentation |
Reads Landsat MTL or XML metadata files and loads single Landsat Tiffs into a rasterStack. Be aware that by default stackMeta() does NOT import panchromatic bands nor thermal bands with resolutions != 30m.
stackMeta(file, quantity = "all", category = "image", allResolutions = FALSE)
file |
Character. Path to Landsat MTL metadata (*_MTL.txt) file or an Landsat CDR xml metadata file (*.xml). |
quantity |
Character vector. Which quantity should be returned. Options: digital numbers ('dn'), top of atmosphere reflectance ('tre'), at surface reflectance ('sre'), brightness temperature ('bt'), spectral index ('index'), all quantities ('all'). |
category |
Character vector. Which category of data to return. Options 'image': image data, 'pan': panchromatic image, 'index': multiband indices, 'qa' quality flag bands, 'all': all categories. |
allResolutions |
Logical. if |
Returns one single SpatRaster comprising all requested bands.
If allResolutions = TRUE
*and* there are different resolution layers (e.g. a 15m panchromatic band along wit 30m imagery) a list of RasterStacks will be returned.
Be aware that by default stackMeta() does NOT import panchromatic bands nor thermal bands with resolutions != 30m. Use the allResolutions argument to import all layers. Note that nowadays the USGS uses cubic convolution to resample the TIR bands to 30m resolution.
## Example metadata file (MTL)
mtlFile <- system.file("external/landsat/LT52240631988227CUB02_MTL.txt", package="RStoolbox")
## Read metadata
metaData <- readMeta(mtlFile)
summary(metaData)
## Load rasters based on metadata file
lsat <- stackMeta(mtlFile)
lsat
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.