Hi,
I recently found out about Cesium and love the application so far.
I’m learning js atm and ran into a problem I just can’t solve on my own - so maybe someone here has an advice for me and could explain what’s going on.
var czml = [
{“id”:“document”,“name”:“CZML Position Definitions”,“version”:“1.0”},
{“id”:“1”,“name”:“xxx”,“properties”:{“1”:“xx”,“2”:“xx”,“3”:“xx”},“position”:{“cartographicDegrees”:[71.7072,-15.0921,0]}},
{“id”:“2”,“name”:“xxx”,“properties”:{“1”:“xx”,“2”:“xx”,“3”:“xx”},“position”:{“cartographicDegrees”:[-90,0,0]}}
];
var viewer = new Cesium.Viewer(‘cesiumContainer’);
var scene = viewer.scene;
scene.debugShowFramesPerSecond = true;
var Spoints = scene.primitives.add(new Cesium.PointPrimitiveCollection());
var Slabels = scene.primitives.add(new Cesium.LabelCollection());
var fleetdata = new Cesium.CzmlDataSource.load(czml);
viewer.dataSources.add(Cesium.CzmlDataSource.load(czml));
fleetdata.then(function(fleet){
var ships = fleet.entities.values;
for (var i = 0; i < ships.length; i++) {
var ship = ships[i];
var pos = ship.position._value;
Spoints.add({
position: pos,
color: Cesium.Color.YELLOW,
});
Slabels.add({
position: pos,
text: ship.name,
scale: 0.5
});
}
});
This is the code snippet and it works fine. Since I want to add thousands of points, I thought I follow https://cesium.com/blog/2016/03/02/performance-tips-for-points/ for better performance.
I can edit the labels, points and everything - except for the description when I click on a label or point. I want to create an individual description for each ship (with lon/lat/height, display of different properties and so on).
I read somewhere (can’t remember…sry) that when you load a czml that those entities aren’t drawn/displayed, only loaded so you can work with them - I can’t express this well as I haven’t really understood it…
So maybe someone can point me in the right direction to solve this problem.
best regards