footprint {gdalraster}R Documentation

Compute footprint of a raster

Description

footprint() is a wrapper of the gdal_footprint command-line utility (see https://gdal.org/programs/gdal_footprint.html). The function can be used to compute the footprint of a raster file, taking into account nodata values (or more generally the mask band attached to the raster bands), and generating polygons/multipolygons corresponding to areas where pixels are valid, and write to an output vector file. Refer to the GDAL documentation at the URL above for a list of command-line arguments that can be passed in cl_arg. Requires GDAL >= 3.8.

Usage

footprint(src_filename, dst_filename, cl_arg = NULL)

Arguments

src_filename

Character string. Filename of the source raster.

dst_filename

Character string. Filename of the destination vector. If the file and the output layer exist, the new footprint is appended to them, unless the -overwrite command-line argument is used.

cl_arg

Optional character vector of command-line arguments for gdal_footprint.

Details

Post-vectorization geometric operations are applied in the following order:

Value

Logical indicating success (invisible TRUE). An error is raised if the operation fails.

See Also

polygonize()

Examples

evt_file <- system.file("extdata/storml_evt.tif", package="gdalraster")
out_file <- paste0(tempdir(), "/", "storml.geojson")

# Requires GDAL >= 3.8
if (as.integer(gdal_version()[2]) >= 3080000) {
  # command-line arguments for gdal_footprint
  args <- c("-t_srs", "EPSG:4326")
  footprint(evt_file, out_file, args)

  deleteDataset(out_file)
}

[Package gdalraster version 1.10.0 Index]