Skip to main content

Type Alias: MosaicLayerProps<ItemT, SourceT>

MosaicLayerProps<ItemT, SourceT> = CompositeLayerProps & Pick<TileLayerProps, "maxCacheSize" | "maxRequests" | "maxZoom" | "minZoom"> & object

Defined in: packages/deck.gl-geotiff/src/mosaic-layer/mosaic-layer.ts:54

Props for MosaicLayer.

Type Parameters​

ItemT​

ItemT extends MosaicItem = MosaicItem

SourceT​

SourceT = any

Type Declaration​

concurrencyLimiter?​

optional concurrencyLimiter?: ConcurrencyLimiter | null

Caps concurrent HTTP requests for this layer's source fetches.

Defaults to a maximum of 6 concurrent requests per origin, which aligns with browser limits of 6 HTTP/1.1 requests per origin. If your sources support HTTP/2 or HTTP/3, you may want to increase this limit or disable it entirely by passing null.

data​

data: LayerDataSource<ItemT>

The items of the mosaic, each with a WGS84 bbox.

As in other deck.gl layers, this can be an array, a promise of one, or a URL that deck.gl loads. With dataTransform, the URL can be a STAC search, for example: dataTransform: (results: any) => results.features. isLoaded waits for it, and onDataLoad is called once it has loaded.

To change the items, pass a new array, such as [...items, newItem]. deck.gl compares data by reference, and changing the array in place isn't supported.

Give each item a unique id (see MosaicItem.id), unless the items only ever change by appending. The layer caches each item's opened source under its id, which defaults to the item's position in this array. So after the items change in any other way, a new item at a cached position draws as the old one.

extent?​

optional extent?: number[] | null

Only load and render items whose bbox overlaps this bounding box, given as [minLng, minLat, maxLng, maxLat] in WGS84 degrees.

An item that overlaps it is drawn in full, not clipped to it. To limit what an item loads as well, pass the same extent to the layers renderSource returns. Unlike in deck.gl's TileLayer, it does not keep items loading below minZoom.

getSource?​

optional getSource?: (item, options) => Promise<SourceT>

Open the source of an item, such as a COGSource from COGSource.open.

It's called only for items in view. deck.gl aborts signal when it cancels the open: when the layer is removed, or, for an item no longer in view, when more than maxRequests opens are in flight.

When something it reads changes, change updateTriggers.getSource (or updateTriggers.all). The layer then drops every source at once, passing each to onSourceUnload, and opens the sources in view again.

Parameters​

item​

ItemT

options​
concurrencyLimiter?​

ConcurrencyLimiter | null

The layer's current concurrencyLimiter prop. Pass it to COGSource.open so the item's requests join the shared per-origin queue.

getPriority?​

() => Priority

Callback that provides dynamic priority for fetches related to this item.

This is designed to re-sort the limiter's queue on viewport pan, preferring items closer to the viewport center.

reader?​

RangeReader

The layer's current reader prop. Pass it to COGSource.open.

requestInit?​

RequestInit

The layer's current requestInit prop. Pass it to COGSource.open.

signal?​

AbortSignal

Returns​

Promise<SourceT>

onSourceError?​

optional onSourceError?: (item, info) => void

Called when opening an item's source fails, but not when the open was aborted. Supplying it stops deck.gl from logging the error.

Parameters​

item​

ItemT

info​
error​

Error

Returns​

void

onSourceLoad?​

optional onSourceLoad?: (item, info) => void

Called after an item's source has opened. source is the value returned by getSource, or undefined when no getSource was supplied.

Parameters​

item​

ItemT

info​
source?​

SourceT

Returns​

void

onSourceUnload?​

optional onSourceUnload?: (item, info) => void

Called when an item is evicted from the tile cache, with its source.

Parameters​

item​

ItemT

info​
source?​

SourceT

Returns​

void

onViewportLoad?​

optional onViewportLoad?: (entries) => void

Called when the sources of all items currently in the viewport have opened.

Parameters​

entries​

object[]

Returns​

void

reader?​

optional reader?: RangeReader

The RangeReader this layer's sources read through, passed to getSource; defaults to the shared DEFAULT_RANGE_READER.

renderSource​

renderSource: (item, options) => Layer | LayersList | null

Render an item, with the source that getSource opened for it, or undefined when no getSource was supplied.

subLayerProps holds a unique id for the item, and the props deck.gl passes from a composite layer to its sublayers, such as opacity. Spread them into the layers it returns, before their own props: new COGLayer({ ...subLayerProps, source }). An item that returns several layers gives each its own id.

Parameters​

item​

ItemT

options​
source?​

SourceT

subLayerProps​

SubLayerProps

Returns​

Layer | LayersList | null

requestInit?​

optional requestInit?: RequestInit

Headers, credentials and mode for every request of this layer's sources, passed to getSource.