I am trying to update the position of a billboard every second in Cesium. The issue is I cannot pass the updating points to the billboard coordinates. I am using jQuery to load the data. This is what I have

//getting values every second
window.setInterval(function nameSat()
         $.getJSON('', function(data) 
                 lat1 =`${data[0].Latitude  }`
                 lon1 =`${data[0].Longitude }`
                 alt1 =`${data[0].Altitude *1000 }`
                 active1 =`${data[0].Active }`

                var lat = parseInt(lat1);
                var lon = parseInt(lon1);
                var alt = parseInt(alt1);

    }, 1000);

//i want to put the updating coordinates here
function addBillboard() {

        position : Cesium.Cartesian3.fromDegrees(lon180, 40,8000000),
        billboard :{
         scale : 0.03,
            image : '../images/sat.png'
  • Is there more than one object/billboard, or do you want just a single billboard to get its position updated every second? Also, does the server know the upcoming positions in advance, or is it live tracking something? I ask because there are ways to download a full path as opposed to live-updated positions. – emackey Mar 19 '19 at 15:13
  • There is more than 1 billboard updating, I only put one as an example. The server will receive updated values every second but it doesnt have a record of what data will be coming in. – Owen Mar 19 '19 at 16:32

For anybody who might be having an issue similar to me i have found a solution based on a tutorial from https://cesiumjs.org/Cesium/Apps/Sandcastle/index.html?src=Picking.html.

My solution based on this is below:

function addMultipleBillboards() {
    var satelliteURL = '../images/sat.png';
    var facilityUrl = '../images/facility.gif';

//create the billboard first
var satellite1 = viewer.entities.add(
    billboard :
         pixelOffset : new Cesium.Cartesian2(0, -30),
        image : satelliteURL
        id: 'MEO_M003',
        text: 'MEO_M003',
        fillColor: Cesium.Color.AQUAMARINE,
        font: '12px Times New Roman',
        outlineWidth :3

//the do the call for getting data
window.setInterval(function nameSat()
         $.getJSON('', function(data) 
                 lat1 =`${data[0].Latitude  }`
                 lon1 =`${data[0].Longitude }`
                 alt1 =`${data[0].Altitude *1000}`

//i need to parse my data because its a string
var meo_lat1 =parseFloat(lat1);
                 var meo_lon1 =parseFloat(lon1);
                 var meo_alt1 =parseFloat(alt1);

//once parsed, set the position inside the interval 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.