Did everything right (I think?) Everything broke....

1. A concise explanation of the problem you’re experiencing.

I’ve been Developing an Application that shows Camera Fields of View. I had it working but it was slowing down. So I slightly changed when I was querying data, and now my datasources won’t show on the browser.

So I’ve debugged it down to the CZML, It appears that everything is in place for it to work (i.e. the Camera FOV vertex data is in the Cartesian3 Array), but its not showing up.

2. A minimal code example. If you’ve found a bug, this helps us reproduce and repair it.

Small Snippet of my CZML

{

“id” : “C2F5”,

“name”: “Dynamic Polygon with Reference Properties”,

“availability”:“2012-08-04T16:00:00Z/2012-08-04T17:00:00Z”,

“polygon”: {

“positions”: {

“references”: [

“c2v1#position”,

“c2v2#position”,

“c2v3#position”,

“c2v4#position”

]

},

“perPositionHeight” : true,

“material” : {

“solidColor” : {

“color”: {

“rgba” : [255, 0, 0, 50]

}

}

}

}

}, {

“id”: “c1v0”,

“position”: {

“interpolationAlgorithm”: “LINEAR”,

“interpolationDegree”: 1,

“interval” : “2012-08-04T16:00:00Z/2012-08-04T17:00:00Z”,

//“epoch” : “2012-08-04T16:00:00Z”,

“cartographicDegrees”: [

]

}

}, {

“id”: “c1v1”,

“position”: {

“interpolationAlgorithm”: “LINEAR”,

“interpolationDegree”: 1,

“interval” : “2012-08-04T16:00:00Z/2012-08-04T17:00:00Z”,

//“epoch” : “2012-08-04T16:00:00Z”,

“cartographicDegrees”: [

]

}

},

Some Setup Code

var viewer = new Cesium.Viewer(‘cesiumContainer’, {

imageryProvider : new Cesium.ArcGisMapServerImageryProvider({

url : ‘http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer

}),

baseLayerPicker : false

});

//Initialize all of the Data Sources

var DS_901 = new Cesium.CzmlDataSource(‘901czml’);

var DS_layer1 = new Cesium.CzmlDataSource(‘layer1czml’);

//Load the Data sources to the viewer obj

viewer.dataSources.add(DS_901.load(czml901));

viewer.dataSources.add(DS_layer1.load(camera_data)); //must load camera data last, due to global clock initialization

The HTTP Call that grabs the Data

function processL1() {

var xhttp4 = new XMLHttpRequest();

xhttp4.onreadystatechange = function() {

if (xhttp4.readyState === 4 && xhttp4.status === 200) {

console.log(xhttp4.response);

// Execute two functions upon recieving data

//find records to add to data set

//add records to relevant data set

xhttp4.response.forEach(function(element) {

//console.log(element);

var current = element;//JSON.parse(element);

var timestamp = current.data.timestamp;

//get availibility string from timestamp

var tempISO = new Date(timestamp).toISOString();

//console.log(current);

if (current.data.camera_id === 1) {

//console.log(current);

//console.log(current.data.vertices);

convertheights(current);

camera_data[11].position.cartographicDegrees.push(tempISO, current.data.vertices.v0.x, current.data.vertices.v0.y, current.data.vertices.v0.z);

camera_data[12].position.cartographicDegrees.push(tempISO, current.data.vertices.v1.x, current.data.vertices.v1.y, current.data.vertices.v1.z);

camera_data[13].position.cartographicDegrees.push(tempISO, current.data.vertices.v2.x, current.data.vertices.v2.y, current.data.vertices.v2.z);

camera_data[14].position.cartographicDegrees.push(tempISO, current.data.vertices.v3.x, current.data.vertices.v3.y, current.data.vertices.v3.z);

camera_data[15].position.cartographicDegrees.push(tempISO, current.data.vertices.v4.x, current.data.vertices.v4.y, current.data.vertices.v4.z);

if (camC.count > 5) {

camera_data[11].position.cartographicDegrees.splice(0, 4);

camera_data[12].position.cartographicDegrees.splice(0, 4);

camera_data[13].position.cartographicDegrees.splice(0, 4);

camera_data[14].position.cartographicDegrees.splice(0, 4);

camera_data[15].position.cartographicDegrees.splice(0, 4);

}

camC.count++;

}

else if (current.data.camera_id === 2) {

//console.log(current);

convertheights(current);

camera_data[16].position.cartographicDegrees.push(tempISO, current.data.vertices.v0.x, current.data.vertices.v0.y, current.data.vertices.v0.z);

camera_data[17].position.cartographicDegrees.push(tempISO, current.data.vertices.v1.x, current.data.vertices.v1.y, current.data.vertices.v1.z);

camera_data[18].position.cartographicDegrees.push(tempISO, current.data.vertices.v2.x, current.data.vertices.v2.y, current.data.vertices.v2.z);

camera_data[19].position.cartographicDegrees.push(tempISO, current.data.vertices.v3.x, current.data.vertices.v3.y, current.data.vertices.v3.z);

camera_data[20].position.cartographicDegrees.push(tempISO, current.data.vertices.v4.x, current.data.vertices.v4.y, current.data.vertices.v4.z);

if (camC.count > 5) {

camera_data[16].position.cartographicDegrees.splice(0, 4);

camera_data[17].position.cartographicDegrees.splice(0, 4);

camera_data[18].position.cartographicDegrees.splice(0, 4);

camera_data[19].position.cartographicDegrees.splice(0, 4);

camera_data[20].position.cartographicDegrees.splice(0, 4);

}

}

camera_data[0].clock.multiplier = 1;

//DS_layer1.process(camera_data);

});

//move timestamp forward --> doing this after adding records

prevTime.time = prevTime.time + 1000;

console.log(camera_data);

DS_layer1.process(camera_data);

console.log(viewer);

console.log(tReset.count);

//console.log(bounding_boxes);

}

}

xhttp4.responseType = ‘json’;

xhttp4.open(“GET”, “http://10.130.36.13:6824/processL1/” + (prevTime.time + 1000) + “/” + prevTime.time);

xhttp4.send();

tReset.count++;

}

Here is some Debugging content from the Inspector

Why am I not seeing this on my viewer?

Cesium 1.41 ->> Version

Hi Alex,

Are you serving up the CZML files somehow? You should be loading them by their url rather than their name.

So instead of this:

//Initialize all of the Data Sources

var DS_901 = new Cesium.CzmlDataSource(‘901czml’);

//Load the Data sources to the viewer obj

viewer.dataSources.add(DS_901.load(czml901));

``

Try something like this:

Cesium.CzmlDataSource.load(‘path/to/901czml’).then(function(czml) {

viewer.dataSources.add(czml);

});

``

I’m not sure where camera_data is in this case, so I can’t tell you what’s happening there.

Thanks,

Gabby

The CZML is just JSON objects that live in the code. The names that I put into the .load functions are the variable names of the OBJs. Turns out after some further debugging it another part of the system that that is sending false data. I posted it here a last resort, because I couldnt find the error. So I will keep this post Updated with current developments.