bbox_from_dim_gt: Bounding box from dimensions and geotransform

View source: R/grid_helpers.R

bbox_from_dim_gtR Documentation

Bounding box from dimensions and geotransform

Description

bbox_from_dim_gt() computes the bounding box from raster dimensions and geotransform coefficients. For rotated rasters, returns the axis-aligned envelope of the four corner coordinates.

Usage

bbox_from_dim_gt(dm, gt)

Arguments

dm

Integer vector of length two containing the raster dimensions (xsize, ysize) in pixels.

gt

Numeric vector of length six containing the geotransform coefficients.

Value

Numeric vector of length four containing the bounding box (xmin, ymin, xmax, ymax) in georeferenced coordinates.

See Also

GDALRaster$getGeoTransform(), GDALRaster$bbox(), gt_from_dim_bbox(), inv_geotransform()

Examples

elev_file <- system.file("extdata/storml_elev.tif", package="gdalraster")
ds <- new(GDALRaster, elev_file)
gt <- ds$getGeoTransform()
dm <- ds$dim()

# should match ds$bbox()
bbox_from_dim_gt(dm, gt)
ds$bbox()

ds$close()

gdalraster documentation built on March 25, 2026, 9:07 a.m.