Hello, good afternoon. I have an error that does not always occur, and I’m not sure if it is due to a mistake on our part or a limitation of the free version of Cesium.
I use Nuxt3, and I have this code to initiate the viewer and load assets from Ion:
let viewer = null;
let terrainProvider = null;
const accessToken = 'Token value';
onMounted(async () => {
await loadViewer();
});
const loadViewer = async () => {
try {
Cesium.Ion.defaultAccessToken = accessToken;
terrainProvider = await Cesium.CesiumTerrainProvider.fromIonAssetId('id asset terrain', {
requestVertexNormals: false,
});
viewer = new Cesium.Viewer(cesiumContainer.value, {
terrainProvider: terrainProvider,
homeButton: false,
geocoder: false,
baseLayerPicker: false,
animation: false,
timeline: false,
infoBox: false,
});
const imageryProvider = await Cesium.IonImageryProvider.fromAssetId('id assets imagery');
const cesiumImagery = new Cesium.ImageryLayer(imageryProvider);
viewer.imageryLayers.add(cesiumImagery);
const resource = await Cesium.IonResource.fromAssetId('id assets geojson');
const dataSource = await Cesium.GeoJsonDataSource.load(resource);
await viewer.dataSources.add(dataSource);
} catch (error) {
console.log(error);
}
}
Everything worked quite well for me, but many times when zooming in from outside the map to the assets very quickly, Cesium hangs, and the browser’s status bar remains on “waiting for assets.ion…etc”. If I go to the network tab in the developer tools, I see that there are assets or files that are part of the assets in pending, and it stays like that indefinitely. They do not load.
Other times I use in a button:
await viewer.flyTo(cesiumImagery, {
offset: new Cesium.HeadingPitchRange(0, Cesium.Math.toRadians(-90), 6500)
});
and as it flies quickly to where the asset is, sometimes Cesium hangs in the same way.
Please, if you can guide me. Am I doing something wrong? Or is it some limitation of Cesium Community for free?
Thank you in advance for your attention.