I have an app that displays flights pilots have taken. I generate a GeoJSON file that displays all the airports and routes the pilots have taken. I also replace the billboard with a custom image for airports and waypoints. Everything works great, except when a pilot has something like over 1,000 entities on their map. When this happens, Cesium crashes and returns the generic
cesium RangeError: Invalid array length
``
error message.
My code is pretty basic at this point.
function renderMap(data) {
var promise = Cesium.GeoJsonDataSource.load(data, {
stroke: Cesium.Color.fromBytes(0, 230, 240, 40)
});
promise.then(function(dataSource) {
viewer.dataSources.add(dataSource);
viewer.zoomTo(dataSource);
var entities = dataSource.entities.values;
for (var i = 0; i < entities.length; i++) {
var entity = entities[i];
if (entity.billboard != undefined) {
if (entity.properties.feature_type._value === "airport") {
entity.billboard.image = "airport.png";
} else if (entity.properties.feature_type._value === "waypoint") {
entity.billboard.image = "waypoint.png";
}
entity.billboard.horizontalOrigin = Cesium.HorizontalOrigin.CENTER;
entity.billboard.verticalOrigin = Cesium.VerticalOrigin.CENTER;
entity.billboard.eyeOffset = new Cesium.Cartesian3( 0, 0, -100 );
}
}
})
}
``
What am I missing here? Is this a bug with larger numbers of entities, or am I adding custom images to entities improperly?
Thanks for the help!