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:
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 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?
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.
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.