Skip to contents

Writes an hsi_cube object as a multi-band GeoTIFF file. Requires the terra package. Values are stored as float64 to preserve the R double range and precision; this can use more disk space than float32 TIFF. A completed temporary TIFF replaces the target only after encoding succeeds; ordinary write failures leave an existing target intact.

Usage

hs_write_tiff(cube, path, verbose = TRUE)

Arguments

cube

An hsi_cube object.

path

Character. Output path (should end in .tif).

verbose

Logical. Print progress. Default TRUE.

Value

Invisible path to the written file.

Examples

# \donttest{
if (requireNamespace("terra", quietly = TRUE)) {
  cube <- hs_example_cube()
  path <- file.path(tempdir(), "example_cube.tif")
  hs_write_tiff(cube, path, verbose = FALSE)
  file.exists(path)
}
#> [1] TRUE
# }