raster_metadata: Get metadata from raster paths

View source: R/raster_metadata.R

raster_metadataR Documentation

Get metadata from raster paths

Description

This accessory function extract some useful metadata from a vector of raster paths.

Usage

raster_metadata(raster_paths, meta = "all", format = "data.table")

Arguments

raster_paths

A vector of raster paths.

meta

Vector with the desired metadata: one or more values among 'res', 'size', 'bbox', 'proj', 'unit', 'outformat', 'type'. Alternatively meta = 'all' (default) allows to return all metadata.

format

One between data.table (default), data.frame and list.

Value

A data.table, data.frame or list of the output metadata.

Note

License: GPL 3.0

Author(s)

Luigi Ranghetti, phD (2019)

References

L. Ranghetti, M. Boschetti, F. Nutini, L. Busetto (2020). "sen2r": An R toolbox for automatically downloading and preprocessing Sentinel-2 satellite data. Computers & Geosciences, 139, 104473. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/j.cageo.2020.104473")}, URL: https://sen2r.ranghetti.info/.

Examples

# Define product names
examplenames <- c(
  system.file("tif/L7_ETMs.tif", package="stars"),
  system.file("extdata/out/S2A2A_20190723_022_Barbellino_BOA_10.tif",
    package = "sen2r")
)


# Return metadata as data.table
raster_metadata(examplenames)


# Return some metadata as data.table
raster_metadata(examplenames, c("res", "size", "bbox", "outformat"))

# Return some metadata as list
raster_metadata(examplenames, c("res", "size", "bbox", "proj"), format = "list")

# Output with an invalid raster
examplenames <- c(
  examplenames, 
  system.file("extdata/settings/gdal_formats.json", package="sen2r")
)
raster_metadata(examplenames, c("bbox", "proj"))

ggranga/fidolasen documentation built on March 29, 2024, 10:32 p.m.