What is wrong with my CZML?

Hi All,

I’m working on adding czml output support for MapGuide (an open source web mapping server).

For some reason, the attached czml (that is produced by a MapGuide extension I’m working on) will not load in Cesium. When I try to load this czml from the Sandcastle, it will fail with the following error:

An error occurred while rendering. Rendering has stopped.
This may indicate an incompatibility with your hardware or web browser, or it may indicate a bug in the application. Visit http://get.webgl.org to verify that your web browser and hardware support WebGL. Consider trying a different web browser or updating your video drivers. Detailed error information is below:

DeveloperError: right is required
Error
at new DeveloperError (http://localhost/mapguide/cesium/Source/Core/DeveloperError.js:43:19)
at Function.Cartesian3.subtract (http://localhost/mapguide/cesium/Source/Core/Cartesian3.js:458:19)
at Function.PolylineGeometry.createGeometry (http://localhost/mapguide/cesium/Source/Core/PolylineGeometry.js:233:28)
at createPolylineGeometry (http://localhost/mapguide/cesium/Source/Workers/createPolylineGeometry.js:12:33)
at createGeometry (http://localhost/mapguide/cesium/Source/Workers/createGeometry.js:39:30)
at DedicatedWorkerGlobalScope. (http://localhost/mapguide/cesium/Source/Workers/createTaskProcessorWorker.js:55:42)

``

The JS code I used for the sandcastle is simply:

var viewer = new Cesium.Viewer(‘cesiumContainer’);
var roadsSource = new Cesium.CzmlDataSource();
roadsSource.loadUrl(“path/to/features.czml”).then(function() {
viewer.dataSources.add(roadsSource);
});

``

The CZML is just raw polyline packets with a line color defined for each packet. All cartographicDegrees arrays are in multiples of 3. Nothing seems to be un-toward.

I tried to debug the problem by sticking some breakpoints at Cartesian3.js:458 to try and at least identify the offending polyline that’s throwing the DeveloperError, but Chrome DevTools refuses to break at the point the DeveloperErrors are thrown, yet continues to throw the error anyway (???)

I also tried to use the CZML validator to see if it could detect any problems with my CZML, but the validator was dead on arrival for me: https://github.com/AnalyticalGraphicsInc/czml-writer/issues/93

Any ideas?

  • Jackie

features.czml (114 KB)

I can display pieces of this file just fine. I suggest you widdle it down to a smaller file that reproduces the bug.

Object ID=0_segment_83_540ed95b21408 has two points and they are at the same location.

It looks like Cesium doesn’t like having polylines with repeated positions.

I suspect this sample has more repeats that just this one. I attempted to display just this one object and it fails as you describe. I adjusted the second location and it displays fine.

Thanks for the heads up, this gives me more to work with.

Just to go slightly off-topic, that czml fragment was created from a single multi-linestring feature (which made the output a bit hard to whittle down). My code “explodes” that multi-linestring geometry and writes out a czml polyline packet for each individual component linestring.

Does CZML support the concept of multi-geometries (ie. A single packet with multiple geometry parts)? If not, would my above approach be a feasible workaround?

  • Jackie

I could not find an multi-geometry parallel for CZML. I also have KML that uses multi-geometry. I had to create a second shape as well. I tried putting many polygons into one object, but only the last one gets drawn.

About widdling down your object. I only meant the file you posted. I took the first shape and it drew, then took the first half and it didn’t. I keep slitting the file in half until I isolated a single bad object. After 5 or 6 iterations I saw the problem.

You are correct in that CZML does not currently support multi-geometry. There’s no immediate plans to add support for it; but it’s not completely ruled out either. Ideally we would have a way to define similar functionality without special “mutli-” types and without having to duplicate data.

Hi All,

I’ve upgraded to Cesium 1.5 and my roads CZML is failing again with this error.

TypeError: Cannot read property ‘x’ of undefined

TypeError: Cannot read property ‘x’ of undefined

at Function.i.subtract (http://localhost/mapguide/rest/assets/cesium/Workers/createGeometry.js:58:6359)

at Function.v.createGeometry (http://localhost/mapguide/rest/assets/cesium/Workers/createPolylineGeometry.js:60:26179)

at e (http://localhost/mapguide/rest/assets/cesium/Workers/createPolylineGeometry.js:60:27751)

at i (http://localhost/mapguide/rest/assets/cesium/Workers/createGeometry.js:61:26619)

at DedicatedWorkerGlobalScope. (http://localhost/mapguide/rest/assets/cesium/Workers/createGeometry.js:61:25920)

``

This time, I have been able to whittle down to the offending CZML packet (attached: features2.czml)

Any idea what is wrong with this packet? It was working in older releases.

  • Jackie

features2.czml (608 Bytes)

I submitted an issue for this: https://github.com/AnalyticalGraphicsInc/cesium/issues/2375

Since the values in the file only vary at the 11th decimal place, they are (probably incorrectly) being treated as duplicates and thrown out, leaving only 1 position (which is then detected by the geometry and an error is thrown). Keep an eye on the above issue and hopefully we’ll have a fix soon.

This works in 1.4 because it had some bugs related to duplicate (or near duplicate) positions that would cause “gaps” to appear in some polylines. Basically our duplicate detection was not good enough. See https://github.com/AnalyticalGraphicsInc/cesium/issues/2136 for the details.