1. A concise explanation of the problem you’re experiencing.
We are using Cesium in a web-based application, developed in Typescript. However, we have issues when trying to add some (not all) imagery providers. The providers that are failing are:
MapboxImageryProvider
OpenStreetMapImageryProvider
And the error we get is:
Property ‘OpenStreetMapImageryProvider’ does not exist on type ‘typeof Cesium’.ts(2339)
However, these imagery providers work:
IonImageryProvider
layers.addImageryProvider(new Cesium.ArcGisMapServerImageryProvider({
2. A minimal code example. If you’ve found a bug, this helps us reproduce and repair it.
Failing:
layers.addImageryProvider(new MapboxImageryProvider({
mapId: ‘mapbox.streets’,
accessToken: ‘CBRE - Accesos y comunicaciones | Mapbox’
}));
Error msg: Property ‘MapboxImageryProvider’ does not exist on type ‘typeof Cesium’. Did you mean ‘BingMapsImageryProvider’?ts(2551)
Working ok:
layers.addImageryProvider(new Cesium.IonImageryProvider({ assetId: typeMap === ‘satelite’ ? 4 : 2 }))
layers.addImageryProvider(new Cesium.ArcGisMapServerImageryProvider({
url : ‘World_Imagery (MapServer)’
}))
3. Context. Why do you need to do this? We might know a better way to accomplish your goal.
We want to offer to the user the ability to use different base map layers from different providers.
4. The Cesium version you’re using, your operating system and browser.
“cesium”: “^1.57.0”,
“@types/cesium”: “^1.54.4”,