ZarrImageryLayer
Custom Cesium imagery layer for Zarr datasets.
Remarks
Extends Cesium's ImageryLayer to support real-time updates to
visualization style (opacity, color map, scale) from Zarr-based data.
Param
Instance of ZarrLayerProvider.
Param
Cesium viewer instance.
Extends
ImageryLayer
Constructors
Constructor
new ZarrImageryLayer(imageryProvider?, options?): ZarrImageryLayer;
Parameters
| Parameter | Type |
|---|---|
imageryProvider? | ImageryProvider |
options? | ConstructorOptions |
Returns
ZarrImageryLayer
Inherited from
ImageryLayer.constructor
Methods
destroy()
destroy(): void;
Destroys the WebGL resources held by this object. Destroying an object allows for deterministic release of WebGL resources, instead of relying on the garbage collector to destroy this object.
Once an object is destroyed, it should not be used; calling any function other than
isDestroyed will result in a DeveloperError exception. Therefore,
assign the return value (undefined) to the object as done in the example.
Returns
void
Example
imageryLayer = imageryLayer && imageryLayer.destroy();
Inherited from
ImageryLayer.destroy
getImageryRectangle()
getImageryRectangle(): Rectangle;
Computes the intersection of this layer's rectangle with the imagery provider's availability rectangle, producing the overall bounds of imagery that can be produced by this layer.
Returns
A rectangle which defines the overall bounds of imagery that can be produced by this layer.
Example
// Zoom to an imagery layer.
const imageryRectangle = imageryLayer.getImageryRectangle();
scene.camera.flyTo({
destination: rectangle
});
Inherited from
ImageryLayer.getImageryRectangle
isBaseLayer()
isBaseLayer(): boolean;
Gets a value indicating whether this layer is the base layer in the ImageryLayerCollection. The base layer is the one that underlies all others. It is special in that it is treated as if it has global rectangle, even if it actually does not, by stretching the texels at the edges over the entire globe.
Returns
boolean
true if this is the base layer; otherwise, false.
Inherited from
ImageryLayer.isBaseLayer
isDestroyed()
isDestroyed(): boolean;
Returns true if this object was destroyed; otherwise, false.
If this object was destroyed, it should not be used; calling any function other than
isDestroyed will result in a DeveloperError exception.
Returns
boolean
True if this object was destroyed; otherwise, false.
Inherited from
ImageryLayer.isDestroyed
softRefreshCurrentView()
softRefreshCurrentView(): void;
Forces a re-render of the current view to reflect updated imagery.
Returns
void
updateSelectors()
updateSelectors(selectors): void;
Update the selectors used for slicing the Zarr dataset.
Parameters
| Parameter | Type | Description |
|---|---|---|
selectors | { [key: string]: ZarrSelectorsProps; } | New selectors to apply. |
Returns
void
updateStyle()
updateStyle(opts): void;
Update the visual style of the imagery layer.
Parameters
| Parameter | Type | Description |
|---|---|---|
opts | { colormap?: string; opacity?: number; scale?: [number, number]; } | Style options to update. |
opts.colormap? | string | Colormap name. |
opts.opacity? | number | Layer opacity. |
opts.scale? | [number, number] | [min, max] range for data scaling. |
Returns
void
fromProviderAsync()
static fromProviderAsync(imageryProviderPromise, options?): ImageryLayer;
Create a new imagery layer from an asynchronous imagery provider. The layer will handle any asynchronous loads or errors, and begin rendering the imagery layer once ready.
Parameters
| Parameter | Type | Description |
|---|---|---|
imageryProviderPromise | Promise<ImageryProvider> | A promise which resolves to a imagery provider |
options? | ConstructorOptions | An object describing initialization options |
Returns
ImageryLayer
The created imagery layer.
Examples
// Create a new base layer
const viewer = new Cesium.Viewer("cesiumContainer", {
baseLayer: Cesium.ImageryLayer.fromProviderAsync(Cesium.IonImageryProvider.fromAssetId(3812));
});
// Add a new transparent layer
const imageryLayer = Cesium.ImageryLayer.fromProviderAsync(Cesium.IonImageryProvider.fromAssetId(3812));
imageryLayer.alpha = 0.5;
viewer.imageryLayers.add(imageryLayer);
// Handle loading events
const imageryLayer = Cesium.ImageryLayer.fromProviderAsync(Cesium.IonImageryProvider.fromAssetId(3812));
viewer.imageryLayers.add(imageryLayer);
imageryLayer.readyEvent.addEventListener(provider => {
imageryLayer.provider.errorEvent.addEventListener(error => {
alert(`Encountered an error while loading imagery tiles! ${error}`);
});
});
imageryLayer.errorEvent.addEventListener(error => {
alert(`Encountered an error while creating an imagery layer! ${error}`);
});
Inherited from
ImageryLayer.fromProviderAsync
fromWorldImagery()
static fromWorldImagery(options): ImageryLayer;
Create a new imagery layer for ion's default global base imagery layer, currently Bing Maps. The layer will handle any asynchronous loads or errors, and begin rendering the imagery layer once ready.
Parameters
| Parameter | Type | Description |
|---|---|---|
options | ConstructorOptions | An object describing initialization options |
Returns
ImageryLayer
The created imagery layer.
Examples
// Add a new transparent layer
const imageryLayer = Cesium.ImageryLayer.fromWorldImagery();
imageryLayer.alpha = 0.5;
viewer.imageryLayers.add(imageryLayer);
// Handle loading events
const imageryLayer = Cesium.ImageryLayer.fromWorldImagery();
viewer.imageryLayers.add(imageryLayer);
imageryLayer.readyEvent.addEventListener(provider => {
imageryLayer.provider.errorEvent.addEventListener(error => {
alert(`Encountered an error while loading imagery tiles! ${error}`);
});
});
imageryLayer.errorEvent.addEventListener(error => {
alert(`Encountered an error while creating an imagery layer! ${error}`);
});
// Create a new base layer
const viewer = new Cesium.Viewer("cesiumContainer", {
baseLayer: Cesium.ImageryLayer.fromWorldImagery();
});
Inherited from
ImageryLayer.fromWorldImagery
Properties
alpha
alpha: number;
The alpha blending value of this layer, with 0.0 representing fully transparent and 1.0 representing fully opaque.
Inherited from
ImageryLayer.alpha
brightness
brightness: number;
The brightness of this layer. 1.0 uses the unmodified imagery color. Less than 1.0 makes the imagery darker while greater than 1.0 makes it brighter.
Inherited from
ImageryLayer.brightness
colorToAlpha
colorToAlpha: Color;
Color value that should be set to transparent.
Inherited from
ImageryLayer.colorToAlpha
colorToAlphaThreshold
colorToAlphaThreshold: number;
Normalized (0-1) threshold for color-to-alpha.
Inherited from
ImageryLayer.colorToAlphaThreshold
contrast
contrast: number;
The contrast of this layer. 1.0 uses the unmodified imagery color. Less than 1.0 reduces the contrast while greater than 1.0 increases it.
Inherited from
ImageryLayer.contrast
cutoutRectangle
cutoutRectangle: Rectangle;
Rectangle cutout in this layer of imagery.
Inherited from
ImageryLayer.cutoutRectangle
dayAlpha
dayAlpha: number;
The alpha blending value of this layer on the day side of the globe, with 0.0 representing fully transparent and
1.0 representing fully opaque. This only takes effect when Globe#enableLighting is true.
Inherited from
ImageryLayer.dayAlpha
gamma
gamma: number;
The gamma correction to apply to this layer. 1.0 uses the unmodified imagery color.
Inherited from
ImageryLayer.gamma
hue
hue: number;
The hue of this layer in radians. 0.0 uses the unmodified imagery color.
Inherited from
ImageryLayer.hue
id
id: string = '';
Unique identifier for the cube provider instance.
imageryProvider
imageryProvider: ZarrLayerProvider;
Gets the imagery provider for this layer. This should not be called before ImageryLayer#ready returns true.
Overrides
ImageryLayer.imageryProvider
magnificationFilter
magnificationFilter: TextureMagnificationFilter;
The TextureMagnificationFilter to apply to this layer. Possible values are TextureMagnificationFilter.LINEAR (the default) and TextureMagnificationFilter.NEAREST.
To take effect, this property must be set immediately after adding the imagery layer. Once a texture is loaded it won't be possible to change the texture filter used.
Inherited from
ImageryLayer.magnificationFilter
minificationFilter
minificationFilter: TextureMinificationFilter;
The TextureMinificationFilter to apply to this layer. Possible values are TextureMinificationFilter.LINEAR (the default) and TextureMinificationFilter.NEAREST.
To take effect, this property must be set immediately after adding the imagery layer. Once a texture is loaded it won't be possible to change the texture filter used.
Inherited from
ImageryLayer.minificationFilter
nightAlpha
nightAlpha: number;
The alpha blending value of this layer on the night side of the globe, with 0.0 representing fully transparent and
1.0 representing fully opaque. This only takes effect when Globe#enableLighting is true.
Inherited from
ImageryLayer.nightAlpha
ready
readonly ready: boolean;
Returns true when the terrain provider has been successfully created. Otherwise, returns false.
Inherited from
ImageryLayer.ready
readyEvent
readonly readyEvent: Event<ReadyEventCallback>;
Gets an event that is raised when the imagery provider has been successfully created. Event listeners are passed the created instance of ImageryProvider.
Inherited from
ImageryLayer.readyEvent
rectangle
readonly rectangle: Rectangle;
Gets the rectangle of this layer. If this rectangle is smaller than the rectangle of the ImageryProvider, only a portion of the imagery provider is shown.
Inherited from
ImageryLayer.rectangle
saturation
saturation: number;
The saturation of this layer. 1.0 uses the unmodified imagery color. Less than 1.0 reduces the saturation while greater than 1.0 increases it.
Inherited from
ImageryLayer.saturation
show
show: boolean;
Determines if this layer is shown.
Inherited from
ImageryLayer.show
splitDirection
splitDirection: SplitDirection;
The SplitDirection to apply to this layer.
Inherited from
ImageryLayer.splitDirection
viewer?
optional viewer: Viewer;
DEFAULT_APPLY_COLOR_TO_ALPHA_THRESHOLD
static DEFAULT_APPLY_COLOR_TO_ALPHA_THRESHOLD: number;
This value is used as the default threshold for color-to-alpha if one is not provided during construction or by the imagery provider.
Inherited from
ImageryLayer.DEFAULT_APPLY_COLOR_TO_ALPHA_THRESHOLD
DEFAULT_BRIGHTNESS
static DEFAULT_BRIGHTNESS: number;
This value is used as the default brightness for the imagery layer if one is not provided during construction or by the imagery provider. This value does not modify the brightness of the imagery.
Inherited from
ImageryLayer.DEFAULT_BRIGHTNESS
DEFAULT_CONTRAST
static DEFAULT_CONTRAST: number;
This value is used as the default contrast for the imagery layer if one is not provided during construction or by the imagery provider. This value does not modify the contrast of the imagery.
Inherited from
ImageryLayer.DEFAULT_CONTRAST
DEFAULT_GAMMA
static DEFAULT_GAMMA: number;
This value is used as the default gamma for the imagery layer if one is not provided during construction or by the imagery provider. This value does not modify the gamma of the imagery.
Inherited from
ImageryLayer.DEFAULT_GAMMA
DEFAULT_HUE
static DEFAULT_HUE: number;
This value is used as the default hue for the imagery layer if one is not provided during construction or by the imagery provider. This value does not modify the hue of the imagery.
Inherited from
ImageryLayer.DEFAULT_HUE
DEFAULT_MAGNIFICATION_FILTER
static DEFAULT_MAGNIFICATION_FILTER: TextureMagnificationFilter;
This value is used as the default texture magnification filter for the imagery layer if one is not provided during construction or by the imagery provider.
Inherited from
ImageryLayer.DEFAULT_MAGNIFICATION_FILTER
DEFAULT_MINIFICATION_FILTER
static DEFAULT_MINIFICATION_FILTER: TextureMinificationFilter;
This value is used as the default texture minification filter for the imagery layer if one is not provided during construction or by the imagery provider.
Inherited from
ImageryLayer.DEFAULT_MINIFICATION_FILTER
DEFAULT_SATURATION
static DEFAULT_SATURATION: number;
This value is used as the default saturation for the imagery layer if one is not provided during construction or by the imagery provider. This value does not modify the saturation of the imagery.
Inherited from
ImageryLayer.DEFAULT_SATURATION
DEFAULT_SPLIT
static DEFAULT_SPLIT: SplitDirection;
This value is used as the default split for the imagery layer if one is not provided during construction or by the imagery provider.
Inherited from
ImageryLayer.DEFAULT_SPLIT