Hi, i have more than 800 pairs of coordinates to mark on Cesium.
Curently my code (for one pair) looks like this:
<script>
var viewer = new Cesium.Viewer('cesiumContainer');
var pinBuilder = new Cesium.PinBuilder();
var entity = viewer.entities;
entity.add({
position : Cesium.Cartesian3.fromDegrees(16.8307423201397, 46.1628499951466),
label : {
text : 'PARK-3042',
verticalOrigin : Cesium.VerticalOrigin.TOP
},
billboard : {
image: pinBuilder.fromColor(Cesium.Color.ROYALBLUE, 48).toDataURL(),
verticalOrigin : Cesium.VerticalOrigin.BOTTOM
}
</script>
Here’s a Sandcastle example that should get you going. It creates 800 random points distributed evenly around the globe.
var viewer = new Cesium.Viewer(‘cesiumContainer’);
var billboard = new Cesium.BillboardGraphics( {
image: (new Cesium.PinBuilder()).fromColor(Cesium.Color.ROYALBLUE, 48).toDataURL(),
verticalOrigin : Cesium.VerticalOrigin.BOTTOM
});
for (var i = 0 ; i < 800; i++)
{
var lon = -180.0 + (Math.random() * 360.0);
var lat = -90.0 + (Math.random() * 180.0);
var entity = new Cesium.Entity();
entity.position = Cesium.Cartesian3.fromDegrees(lon, lat);
entity.label = new Cesium.LabelGraphics();
entity.label.text = "PARK-" + i;
entity.label.verticalOrigin = Cesium.VerticalOrigin.BOTTOM;
entity.billboard = billboard;
viewer.entities.add(entity);
}
``
Scott
Thank you very much. It works perfectly!