ts_te: Target size and extent for GDAL command line

View source: R/gdal-utils-helpers.R

ts_teR Documentation

Target size and extent for GDAL command line

Description

Format grid properties for GDAL command line options (-ts for target size, -te for target extent).

Usage

ts_te(dimension, extent)

gdal_te(extent)

gdal_ts(dimension)

Arguments

dimension

integer vector of ncol, nrow (target size)

extent

numeric vector of xmin, xmax, ymin, ymax (target extent)

Details

These functions generate the string arguments used by GDAL utilities like gdalwarp and gdal_translate. The gdal_ts() function is named after the GDAL -ts flag and gdal_te() after the GDAL -te flag.

Value

A character string formatted for GDAL command line:

  • ts_te(): combined -ts and -te arguments

  • gdal_ts(): ⁠-ts ncol nrow⁠ string

  • gdal_te(): ⁠-te xmin ymin xmax ymax⁠ string (note: reordered for GDAL)

See Also

vcrop() for computing aligned extents

Examples

ts_te(c(10, 100), 1:4)

gdal_ts(c(10, 100))

gdal_te(1:4)

## use in a GDAL command (not run)
## Not run: 
cmd <- sprintf("gdalwarp %s %s input.tif output.tif",
               gdal_ts(c(1000, 500)), gdal_te(c(-180, 180, -90, 90)))

## End(Not run)

vaster documentation built on March 10, 2026, 5:08 p.m.