"Invalid array length" loading KML (LineString)

Hi all,

I’m suffering an error loading this KML (a single LineString) with Cesium 1.25:

<?xml version="1.0" encoding="UTF-8"?> ff0000ff 6 1 -16.41549000000001,28.44423000000001 -16.41549000000001,28.44423000000001 -16.41505000000001,28.44430000000001 -16.41507000000001,28.44430000000001 -16.41473000000001,28.44460000000001 -16.41429000000001,28.44452000000001 -16.41430000000001,28.44453000000001 -16.41428000000001,28.44452000000001 -16.41416000000001,28.44434000000001 -16.41415000000001,28.44434000000001 -16.41397000000001,28.44408000000001

``

This is the error:

Cesium.js:172275 An error occurred while rendering. Rendering has stopped.
undefined
RangeError: Invalid array length
RangeError: Invalid array length
at updateFrustums (http://localhost/Cesium/CesiumUnminified/Cesium.js:162245:36)
at createPotentiallyVisibleSet (http://localhost/Cesium/CesiumUnminified/Cesium.js:162470:13)
at executeCommandsInViewport (http://localhost/Cesium/CesiumUnminified/Cesium.js:163163:9)
at updateAndExecuteCommands (http://localhost/Cesium/CesiumUnminified/Cesium.js:163030:17)
at render (http://localhost/Cesium/CesiumUnminified/Cesium.js:163454:9)
at Scene.render (http://localhost/Cesium/CesiumUnminified/Cesium.js:163492:13)
at CesiumWidget.render (http://localhost/Cesium/CesiumUnminified/Cesium.js:172322:25)
at render (http://localhost/Cesium/CesiumUnminified/Cesium.js:171710:32)CesiumWidget.showErrorPanel @ Cesium.js:172275(anonymous function) @ Cesium.js:172000Event.raiseEvent @ Cesium.js:4797Scene.render @ Cesium.js:163494CesiumWidget.render @ Cesium.js:172322render @ Cesium.js:171710

``

After a lot of tests, I have discovered that the problem is in the coordinates: the first two pairs of coordinates are the same. If I modify any of these (for example, changing the first longitude with -16.4154**8**000000001 the file loads fine. It loads fine, too, if I remove the tessellate element.

Any idea about it? Am I doing something wrong?

Thanks,

Juan Carlos

Hello Juan Carlos,

Sorry, I wasn’t able to reproduce the crash. The KML rendered fine for me.

If you just switched to a new version of Cesium, try clearing your cookies/cache. Sometimes that causes weird problems when switching between versions.

If that doesn’t work, what browser and OS are you using? Maybe it’s specific to that.

Best,

Hannah

Dear Hannah,

Yes, you’re right… I loaded the KML using sandcastle and it went ok. Something is wrong in my code or, as you say, it’s due to the OS or the browser, maybe. I’ll see.

Thanks

Dears,

Making more tests in sandcastle, I discovered that I wasn’t using the terrainProvider, so I added this one. This is the code I used:

var viewer = new Cesium.Viewer(
‘cesiumContainer’,
{
sceneMode:Cesium.SceneMode.SCENE3D,
scene3DOnly:true,
timeline:false,
geocoder:false,
animation:false,
infoBox:false,
baseLayerPicker:false,
fullscreenButton:false,
terrainProvider:new Cesium.CesiumTerrainProvider({
url:“http://assets.agi.com/stk-terrain/world”,
requestVertexNormals:true
})
}
);
var options = {
camera:viewer.scene.camera,
canvas:viewer.scene.canvas,
clampToGround:true
};

var url = ‘http://visortf.grafcan.es/KML/rep/track.kml’;
Sandcastle.addToolbarMenu([{
text : ‘KML - Track (Tenerife)’,
onselect : function() {
var kml = viewer.dataSources.add(Cesium.KmlDataSource.load(url, options));
viewer.zoomTo(kml);
}
}], ‘toolbar’);

Sandcastle.reset = function() {
viewer.dataSources.removeAll();
viewer.clock.clockRange = Cesium.ClockRange.UNBOUNDED;
viewer.clock.clockStep = Cesium.ClockStep.SYSTEM_CLOCK;
};

``

In my first tests I didn’t use the clampToGround property of the option parameter of the KMLDataSource load method. In those test, the KML loaded well, but not clamped to the ground. The app fail if we set the clampToGround property to true.

Can you, Hannah, do the same and check if I’m wrong?

Thanks again,

Juan Carlos

Hi Juan Carlos,

I was able to reproduce the crash when using the clampToGround option. I’ve submitted an issue here for us to look into it: https://github.com/AnalyticalGraphicsInc/cesium/issues/4326

Thanks for providing more detail =)

Best,

Hannah

Thank you very much for your job :wink: