gt_from_dim_bbox: Geotransform from dimensions and bounding box

View source: R/grid_helpers.R

gt_from_dim_bboxR Documentation

Geotransform from dimensions and bounding box

Description

gt_from_dim_bbox() computes geotransform coefficients from raster dimensions and a bounding box. The resulting geotransform will always be north-up (no rotation).

Usage

gt_from_dim_bbox(dm, bbox)

Arguments

dm

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

bbox

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

Value

Numeric vector of length six containing the geotransform coefficients.

See Also

GDALRaster$getGeoTransform(), GDALRaster$setGeoTransform(), GDALRaster$setBbox(), bbox_from_dim_gt(), inv_geotransform()

Examples

# 1-degree global grid
(gt <- gt_from_dim_bbox(c(360, 180), c(-180, -90, 180, 90)))

# verify round-trip
bbox_from_dim_gt(c(360, 180), gt)

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