Skip to main content

Type Alias: ZarrLayerProps<DataT, Dtype>

ZarrLayerProps<DataT, Dtype> = Omit<RasterTileLayerProps<DataT>, "tilesetDescriptor" | "getTileData" | "renderTile"> & object

Defined in: packages/deck.gl-zarr/src/zarr-layer.ts:53

Props for the ZarrLayer.

Type Parameters​

DataT​

DataT extends MinimalTileData = MinimalTileData

Dtype​

Dtype extends zarr.DataType = zarr.DataType

Type Declaration​

getTileData​

getTileData: (arr, options) => Promise<DataT>

Fetch and return the tile data for a given tile coordinate.

The layer picks the zarr array for the requested zoom level and passes it along with a pre-built sliceSpec (one entry per array dim). Call zarr.get(arr, sliceSpec) and convert the result to whatever format your renderTile callback expects.

In the array's dimension_names, the y dim comes before the x dim, and other dims may sit anywhere. zarr.get returns the chunk in the array's own dim order, such as [y, x, band] for a channel-last array.

A new selection fetches the tiles again. For anything else this function reads, change updateTriggers.getTileData (or updateTriggers.all). deck.gl compares each element of a trigger with ===, so keep them the same across renders.

Parameters​

arr​

zarr.Array<Dtype>

options​

GetTileDataOptions

Returns​

Promise<DataT>

onSourceLoad?​

optional onSourceLoad?: (source) => void

Called with the source the layer opened, when source isn't an opened ZarrSource already.

Parameters​

source​

ZarrSource<Dtype>

Returns​

void

renderTile​

renderTile: (data) => RenderTileResult

Convert a loaded DataT tile into a RenderTileResult that the layer can pass to RasterLayer. Return { image } for a simple ImageData / texture, or { renderPipeline } for a GPU shader pipeline.

Parameters​

data​

DataT

Returns​

RenderTileResult

selection​

selection: Record<string, SliceInput>

Selection for non-spatial dimensions. Must include exactly one entry per non-spatial dim in the array. Use a number to pin to a single index, null to use zarr's default slice, or a zarr.Slice for a range.

For datasets with only spatial dimensions (e.g. a plain [H, W] or [bands, H, W] array whose non-spatial dims are already accounted for), pass an empty object {}.

A selection that doesn't fit the source goes to onError, and the layer draws nothing until the selection is fixed. Changing the selection never opens the source again.

Changing the selection fetches the tiles again. Selections are compared by value.

source​

source: ZarrSource<Dtype> | ZarrInput

The GeoZarr data to draw: an opened ZarrSource, or a zarrita store, group or array for the layer to open with the defaults of ZarrSource.open. The layer draws a store's root, since it can't pass a path.

Open the data yourself to change those defaults, such as the path or the GeoZarr metadata, or to share it between layers. Callers build and configure the store either way, for example to wrap a zarr.FetchStore with withConsolidatedMetadata.

The layer doesn't check the data type of data it opens. To check it, open the data yourself and narrow it with ZarrSource.is.

Keep the same object across renders: a new one starts the layer's tiles over.