R: Convert complete image collections to cloud-optimized...

translate_gtiff {gdalcubes} | R Documentation

## Convert complete image collections to cloud-optimized GeoTIFFs

### Description

This function translates all images of a gdalcubes image collection to GeoTIFF files. The output contains converted imagery as an additional copy (original files are not deleted) and a new image collection file.

### Usage

    translate_gtiff(
      collection,
      target_dir = tempfile(pattern = "image_collection_"),
      overwrite = TRUE,
      creation_options = c("TILED=YES", "COMPRESS=DEFLATE", "ZLEVEL=1",
        "COPY_SRC_OVERVIEWS=TRUE")
    )

### Arguments

`collection` | path to an existing image collection file
`target_dir` | directory where the output will be stored, will be created if necessary
`overwrite` | logical; if TRUE existing files will be overwritten
`creation_options` | further settings of the GDAL GTiff driver; see https://gdal.org/drivers/raster/gtiff.html

### Details

The functions `translate_gtiff` and `translate_cog` have the same purpose to convert imagery to optimized GeoTIFF files. The latter uses the recent COG GDAL driver, whereas the former uses the normal GTiff driver. Depending on additional creation options and the input images, files creted with `translate_gtiff` may or may not contain overview images.

### Value

path to the new image collection file for use as argument to `image_collection`

### Examples

    # create image collection from example Landsat data only
    # if not already done in other examples
    if (!file.exists(file.path(tempdir(), "L8.db"))) {
      L8_files <- list.files(system.file("L8NY18", package = "gdalcubes"),
                             ".TIF", recursive = TRUE, full.names = TRUE)
      create_image_collection(L8_files, "L8_L1TP", file.path(tempdir(), "L8.db"))
    }

    L8.col = image_collection(file.path(tempdir(), "L8.db"))
    L8.col

    L8.tif.col = translate_gtiff(L8.col)
    L8.tif.col

[Package gdalcubes version 0.3.1 Index]