Hi,
I have a array of lat long. I want to place a label in all the lat longs present in array.
For Example:
var source=[12,4,usa,13,5,uk];
var labels = scene.primitives.add(new Cesium.LabelCollection());
labels.add({
position : new Cesium.Cartesian3.fromDegrees(source[0], source[1]),
text : 'source[2]'
});
labels.add({
position : new Cesium.Cartesian3.fromDegrees(source[3],source[4]),
text : 'source[5]'
});
How to dynamical update the labels based on the array.
i tried the following code, it didn’t work
var len=source.length
for(var i=0;i<len;i++)
{
var n=(i+2);
viewer.entities.add({
position: Cesium.Cartesian3.fromDegrees(
source
[i], source
[i++]),
label: {
text: source
[n],
scale: 0.4,
fillColor: Cesium.Color.BLACK,
pixelOffset : new Cesium.Cartesian2(50, -25),
pixelOffsetScaleByDistance : new Cesium.NearFarScalar(1.0e3, 1.0, 1.5e6, 0.0)
}
});
}
}
I want to update labels on the map based on array elements.
Thanks and Regards
Vinay