I am working on a project dealing with sensor data. In my backend everything is stored in a database which is getting polled by a controller and converted into kml to display on the cesium globe. This poll happens every 5-10 seconds and contains around 4000-8000 objects (we store up to 1 minute worth of data so we are looking at somewhere like 20k - 50k points). Following this I have an update function which slowly fades the markers out which updates every 5 seconds.
To load the kml on the map I use the following function:
var dataSource = new Cesium.KmlDataSource();
dataSource.load('link').then(function(value){
viewer.dataSources.add(dataSource);
});
On the update color function I am iterating over all of the objects and updating them like so:
newColor being the current color of the object. var colorUpdate = Cesium.Color.fromAlpha(newColor, .4); dataSource.entities.values[i].billboard.color = colorUpdate;
When I do and add or color update I see a large amount of lag and was curious if there was anything you would suggest to fix this? Generally I get a freeze up for a few seconds. After 60 seconds of the data being on the map it gets removed like so:
dataSource.entities.remove(dataSource.entities.values[i]);
Add new objects:
var dataSource = new Cesium.KmlDataSource();
dataSource.load('link').then(function(value);
viewer.dataSources.add(dataSource);
});
Update color:
var colorUpdate = Cesium.Color.fromAlpha(newColor, .4);
dataSource.entities.values[i].billboard.color = colorUpdate;
Remove:
dataSource.entities.remove(dataSource.entities.values[i]);
var dataSource = new Cesium.KmlDataSource();
dataSource.load('link').then(function(value);
viewer.dataSources.add(dataSource);
});
This is creating a datasource which contains an entity collection. I looked at your example, which and is there a way to use kmldatasource and add Reference Properties to the entire collection, without iterating over all of them to add the reference property? Since I am not creating each individual marker and adding them in I still need some guidance as that is how the example above shows it being done.
For example I saw
Cesium.ReferenceProperty.fromString(targetCollection, referenceString)
does that just reset everything in that collection to have that reference string property?
Chris
Also I found point primitive collections and I've found I have minimal lag on a color update there; however they lack the ability to use time intervals? Would these not be a good option to use?