"Invalid array length" loading KML (LineString)

105 views
Skip to first unread message

Juan Carlos

unread,
Sep 15, 2016, 8:23:32 AM9/15/16
to cesium-dev
Hi all,

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

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
   
<Placemark>
       
<Style>
           
<LineStyle>
               
<color>ff0000ff</color>
               
<width>6</width>
           
</LineStyle>
       
</Style>
       
<LineString>
           
<tessellate>1</tessellate>
           
<coordinates>-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</coordinates>
       
</LineString>
   
</Placemark>
</Document>
</kml>

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.41548000000001 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

Hannah Pinkos

unread,
Sep 15, 2016, 10:20:44 AM9/15/16
to cesium-dev
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

Juan Carlos

unread,
Sep 16, 2016, 6:53:15 AM9/16/16
to cesium-dev
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

Juan Carlos

unread,
Sep 16, 2016, 8:38:51 AM9/16/16
to cesium-dev
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

Hannah Pinkos

unread,
Sep 16, 2016, 10:21:44 AM9/16/16
to cesium-dev
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

Juan Carlos

unread,
Sep 16, 2016, 10:23:11 AM9/16/16
to cesium-dev
Thank you very much for your job ;-)
Reply all
Reply to author
Forward
0 new messages