Issue(s) found in v1.4

I found that when I run my code (that worked in v1.2/v1.3) I got a number of errors:

Initially I got the following error:

TypeError: Cannot read property ‘center’ of undefined

at Primitive.update (http://stroomversnelling.visionserver.nl/Cesium/Cesium.js:78357:59)
at PrimitiveCollection.update (http://stroomversnelling.visionserver.nl/Cesium/Cesium.js:119489:27)
at updatePrimitives (http://stroomversnelling.visionserver.nl/Cesium/Cesium.js:124816:27)
at render (http://stroomversnelling.visionserver.nl/Cesium/Cesium.js:124869:9)
at Scene.render (http://stroomversnelling.visionserver.nl/Cesium/Cesium.js:124910:13)
at CesiumWidget.render (http://stroomversnelling.visionserver.nl/Cesium/Cesium.js:134168:25)
at render (http://stroomversnelling.visionserver.nl/Cesium/Cesium.js:133643:32)

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:

DeveloperError: Appearance/Geometry mismatch. The appearance requires vertex shader attribute input ‘compressedAttributes’, which was not computed as part of the Geometry. Use the appearance’s vertexFormat property when constructing the geometry.
Error
at new DeveloperError (http://stroomversnelling.visionserver.nl/Cesium/Cesium.js:1282:19)
at validateShaderMatching (http://stroomversnelling.visionserver.nl/Cesium/Cesium.js:78128:27)
at Primitive.update (http://stroomversnelling.visionserver.nl/Cesium/Cesium.js:78470:13)
at PrimitiveCollection.update (http://stroomversnelling.visionserver.nl/Cesium/Cesium.js:119489:27)
at updatePrimitives (http://stroomversnelling.visionserver.nl/Cesium/Cesium.js:124816:27)
at render (http://stroomversnelling.visionserver.nl/Cesium/Cesium.js:124869:9)
at Scene.render (http://stroomversnelling.visionserver.nl/Cesium/Cesium.js:124910:13)
at CesiumWidget.render (http://stroomversnelling.visionserver.nl/Cesium/Cesium.js:134168:25)
at render (http://stroomversnelling.visionserver.nl/Cesium/Cesium.js:133643:32)

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.

Here is the code that creates the Geometries that I suspect are causing this error. Mind you that this exact code does work in v1.2/v1.3.

function getDistrictGeoInstance(d) {
if (d && d.geo) {
geopositions = ;

for (var i = 0; i < d.geo.length; i++) {
var g = d.geo[i];
geopositions.push(Cesium.Cartographic.fromDegrees(parseFloat(g.lon), parseFloat(g.lat)));
}

var color = Cesium.Color.fromBytes(zerocolor.r, zerocolor.g, zerocolor.b, districtalpha);
var height = 0;

return new Cesium.GeometryInstance({
geometry : Cesium.PolygonGeometry.fromPositions({
positions : ellipsoid.cartographicArrayToCartesianArray(geopositions),
extrudedHeight: height,
vertexFormat : Cesium.PerInstanceColorAppearance.VERTEX_FORMAT
}),
attributes: {
color: Cesium.ColorGeometryInstanceAttribute.fromColor(color)
},
id: “D” + d.id
});
}
}

``

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.

I’m receiving the same error when attempting to load a KML from the latest kml-branch build.

I tried the private/incognito mode though I’m still receiving the same error messages (i.e. the first set of error messages posted).

Can you share the KML that is causing the problem? If I can reproduce it on our end it will hopefully make it easy to fix.

Ah this did fix the issue, thanks. I did remove all browsing data in my “normal mode” but that didn’t fix it… Anyway thanks!

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

at U.update (http://192.168.0.3/cesium-kml/Build/Cesium/Cesium.js:426:23622)

at a.update (http://192.168.0.3/cesium-kml/Build/Cesium/Cesium.js:441:15722)

at ct (http://192.168.0.3/cesium-kml/Build/Cesium/Cesium.js:443:8152)

at dt (http://192.168.0.3/cesium-kml/Build/Cesium/Cesium.js:443:8569)

at vt.render (http://192.168.0.3/cesium-kml/Build/Cesium/Cesium.js:443:14216)

at A.render (http://192.168.0.3/cesium-kml/Build/Cesium/Cesium.js:448:19676)

at t (http://192.168.0.3/cesium-kml/Build/Cesium/Cesium.js:448:7013)

Solved it.

Forgot to replace old JS files with the new ones from the new build.

 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},

it worked fine.