fromProviderAsync

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.

// Create a new base layer
const viewer = new Viewer("cesiumContainer", {
baseLayer: fromProviderAsync(IonImageryProvider.fromAssetId(3812));
});
// Add a new transparent layer
const imageryLayer = ImageryLayer.fromProviderAsync(IonImageryProvider.fromAssetId(3812));
imageryLayer.alpha = 0.5;
viewer.imageryLayers.add(imageryLayer);
// Handle loading events
const imageryLayer = ImageryLayer.fromProviderAsync(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}`);
});

Return

The created imagery layer.

Parameters

imageryProviderPromise

A promise which resolves to a imagery provider

options

An object describing initialization options

See also