After debugging I found out that at line 78357 of Cesium.js the code tried to access:
geometry.boundingSphereCV.center
But the geometry object doesn’t contain boundingSphereCV. However it does contain boundingSphere so I thought I’ll try to change it. Afterwards I got the following error:
At line 78128 of Cesium.js I found a loop checking if attributeLocations contains the same properties as shaderAttributes does (only applicable to it’s own properties). Mostly it does, except for (as the error message mentions) compressedAttributes which causes this error. I’m not quite sure why this is missing but this error might be caused by fixing the first one the way I did.
Does anyone know why this/these error(s) are occurring and how to fix this? If you need any more information please ask.
The above code is called in a loop iterating through al districts and gets an geometryInstance for each of them and saves them to an array after checking if they fit to certain criteria (nothing is changed). After all districts have their geometryInstances the array gets passed into the next function (if it contains at least 1 entry):
function getDistrictsPrimitive(darray) {
return primitives.add(new Cesium.Primitive({
geometryInstances : darray,
appearance: new Cesium.PerInstanceColorAppearance({
closed: true,
translucent: true
})
}));
}
``
I suspect these Instances because Cesium appears to work perfectly until these geometries are added (they are also the first geometries to be added).
As a quick test, can you try and run your app in a new private/incognito mode tab on whatever browser you’re using. Sometimes when upgrading JS libraries, the browser cache fails to pick up the new version immediately resulting in errors like this (private mode ignores the cache so it makes it easy to test for this).
If it still happens in private mode, then we’ll have to dig a little deeper.
The file was too large so I put it into Google Drive
Part of it that probably makes it problematic is rendering both points and polygons (excluding innerBoundaryIs) at times. It appears to load in Google Earth without problems.
It starts to load but then crashes with this error message:
TypeError: Cannot read property ‘center’ of undefined
TypeError: Cannot read property ‘center’ of undefined
An error occurred while rendering. Rendering has stopped.
undefined
TypeError: Cannot read properties of undefined (reading 'center')
TypeError: Cannot read properties of undefined (reading 'center')
Today I also encountered the same error, and finally found that after modifying this configuration
new Cesium.Viewer("cesiumContainer", {scene3DOnly: true},