zarr_conv_spatial: GeoZarr "spatial" convention

zarr_conv_spatialR Documentation

GeoZarr "spatial" convention

Description

This class implements the GeoZarr "spatial" convention. In particular, the following convention is implemented here:

{
  "schema_url": "https://raw.githubusercontent.com/zarr-conventions/spatial/refs/tags/v1/schema.json",
  "spec_url": "https://github.com/zarr-conventions/spatial/blob/v1/README.md",
  "uuid": "689b58e2-cf7b-45e0-9fff-9cfc0883d6b4",
  "name": "spatial",
  "description": "Spatial coordinate information"
}

Super class

zarr::zarr_convention -> zarr_conv_spatial

Active bindings

dimensions

The "spatial:dimensions" attribute, a character vector of dimension names for the Y and X axes, in that order. These names must correspond to the names in the "dimension_names" attribute of the array that this convention relates to.

bbox

The "spatial:bbox" attribute, a numeric vector of 4 values in order ⁠xmin, ymin, xmax, ymax⁠ giving the boundary coordinates of the data array.

transform_type

(read-only) The "spatial:transform_type" attribute, a character string giving the type of coordinate transformation. The only valid value (currently) is "affine".

transform

The "spatial:transform" attribute, a numeric vector of 6 values (1) X resolution; (2) 0; (3) X coordinate of UL corner; (4) 0; (5) Y resolution; (6) Y coordinate of UL corner, giving the transformation coefficients of the coordinates of the data array.

shape

The "spatial:shape" attribute, an integer vector of length 2 giving the length of the X and Y dimensions.

registration

The "spatial:registration" attribute, a string with value "node" or "pixel". "pixel" (the default) means that the coordinates of the UL corner of each grid cell are recorded; "node" means that the coordinates of the center of each grid cell are recorded.

Methods

Public methods

Inherited methods

zarr_conv_spatial$new()

Create a new instance of a "spatial" convention agent.

Usage
zarr_conv_spatial$new()
Returns

A new instance of a "spatial" convention agent.


zarr_conv_spatial$set_coordinates()

Set the coordinate system for this instance. This method sets the affine transform coefficients, as well as the grid cell registration and the bounding box.

Usage
zarr_conv_spatial$set_coordinates(x, y, shape, registration = "pixel")
Arguments
x, y

Coordinates for the X and Y axes, as a numeric vector of two values: the top-left coordinate of the top-left grid cell and the resolution along the axis, respectively. Note that for y the resolution must be negative.

shape

The length of each axis x and y.

registration

Grid cell registration. "pixel" (the default) means that the coordinates in x and y are interpreted as the UL corner of each grid cell; "node" means that the coordinates are interpreted as the center of each grid cell.

Returns

Self, invisibly.


zarr_conv_spatial$write()

Write the data of this instance in the attributes of a Zarr object.

Usage
zarr_conv_spatial$write(attributes)
Arguments
attributes

A list with Zarr attributes for a group or array. The properties will be written at the root level of attributes.

Returns

The updated attributes.


geozarr documentation built on Sept. 16, 2026, 1:07 a.m.