Skip to main content

Class: ZarrSource<Dtype>

Defined in: packages/deck.gl-zarr/src/zarr-source.ts:76

Opened GeoZarr data, ready for a ZarrLayer to draw.

Create it with ZarrSource.open, which reads the metadata, opens the array of each level and resolves the CRS once. Several layers can share one source, such as two layers drawing different selections of it.

Extends​

Type Parameters​

Dtype​

Dtype extends zarr.DataType = zarr.DataType

Properties​

dimensionNames​

readonly dimensionNames: readonly string[]

Defined in: packages/deck.gl-zarr/src/zarr-source.ts:100

The names of the arrays' dimensions, in order, such as ["time", "y", "x"].


levels​

readonly levels: readonly Array<Dtype, Readable>[]

Defined in: packages/deck.gl-zarr/src/zarr-source.ts:94

One opened array per resolution level, finest first. Single-resolution data has one.


node​

readonly node: Group<Readable> | Array<Dtype, Readable>

Defined in: packages/deck.gl-zarr/src/zarr-source.ts:88

The zarrita group or array drawn, at path from the input: the multiscales group of a pyramid, or the array of a single level. Its store holds other arrays, such as coordinates:

zarr.open(zarr.root(source.node.store).resolve("band"), { kind: "array" });

projection​

readonly projection: ProjectionDefinition

Defined in: packages/deck.gl-zarr/src/zarr-source.ts:110

The data's CRS, resolved once.


spatialDims​

readonly spatialDims: [y: string, x: string]

Defined in: packages/deck.gl-zarr/src/zarr-source.ts:107

The names of the y and x dimensions, from spatial:dimensions. In ZarrSource.dimensionNames, y comes before x, and other dimensions may sit anywhere, such as ["band", "y", "x"] or ["y", "x", "band"].

Methods​

is()​

is<D>(dtype): this is ZarrSource<D>

Defined in: packages/deck.gl-zarr/src/zarr-source.ts:133

Whether the levels' data type is dtype, narrowing the source to it, as zarrita's Array.is does for an array.

Type Parameters​

D​

D extends DataType

Parameters​

dtype​

D

Returns​

this is ZarrSource<D>


open()​

static open(input, options?): Promise<ZarrSource<DataType>>

Defined in: packages/deck.gl-zarr/src/zarr-source.ts:162

Open GeoZarr data: read its metadata, open the array of each level, resolve its CRS, and build its tile grid.

An array inherits the proj: and spatial: attributes of the group it's directly in: its own CRS replaces the group's, and each of its own spatial: attributes replaces the group's. See the proj and spatial conventions.

Rejects when signal aborts before the source is ready, when the metadata is missing or invalid, when a level's array can't be opened, when the levels' data types differ, when the CRS can't be resolved, and when the arrays' dimensions aren't named, differ between levels, don't include the y and x dimensions, or have x before y.

Parameters​

input​

ZarrInput

A zarrita store, or an opened group or array within one. Pass a store, unless the app has opened the node already, for example to read coordinate or label arrays or to browse the hierarchy, or needs to control how it was opened: open tries Zarr v3, then v2. The caller owns the store, so it can wrap it, for example with withConsolidatedMetadata.

options?​

ZarrSourceOptions = {}

Returns​

Promise<ZarrSource<DataType>>