Provides raster grid logic without requiring materialized data. Most raster operations are purely functions of dimension (ncol, nrow) and extent (xmin, xmax, ymin, ymax) - vaster provides these operations as simple functions on numbers, independent of any file format or geospatial library.

Core concepts

A raster grid is defined by two properties:

  • dimension: c(ncol, nrow) - the number of columns and rows

  • extent: c(xmin, xmax, ymin, ymax) - the bounding box

From these six numbers, all grid geometry can be computed: cell indices, coordinates, resolutions, and spatial queries.

Cell indexing

Cells are numbered from 1, starting at the top-left corner, proceeding right then down (row-major order). This matches the convention used by the raster and terra packages.

Main function families

Cell operations (cells):

Coordinate operations (coordinates):

Grid properties (grid):

Grid modification:

Cell adjacency (adjacency):

  • adjacency() - neighbour cell indices (queen, rook, or bishop)

GDAL interoperability:

Output and display:

Utilities:

  • from_xyz() - derive grid dimension and extent from XYZ points

  • fit_dims() - compute dimension from aspect ratio and target size

Extent convention

vaster uses extent as c(xmin, xmax, ymin, ymax), which differs from the bbox convention c(xmin, ymin, xmax, ymax). Both represent the same information in different order.

If extent is not provided, the default is c(0, ncol, 0, nrow) - matching the convention adopted by stars, terra, and an improvement on base R's image() which scales to 0-1.

Author

Maintainer: Michael Sumner mdsumner@gmail.com (ORCID)

Other contributors:

  • Robert Hijmans (Wrote original versions of abstract cell operations in raster package) [contributor]