Czml file to georeference GLTF model.

Hello everybody,

I want to add to the Cesium globe a GLTF model georeferenced with CZML.

When I directly write the CZML code into the javascript file, it is perfectly working:
var builtInCzml =
[
{
“id” : “Tour eiffel”,
“version” : “1.0”
},
{
“id” : “TE”,
“model” : {
“gltf” : “test_kmz_data.gltf”,
“scale” : 1,
“show” : [{
“boolean” : true
}]
},
“position”:{
“cartographicDegrees”:[
2.294167,48.858333,33,
]
}
}
]

    var czmlDataSource = new Cesium.CzmlDataSource();
    czmlDataSource.load(builtInCzml, 'Built-in CZML');
    viewer.dataSources.add(czmlDataSource);

``

However, I want to do it with an external CZML file (see attached).
I followed the CZML sandcastle sample and tried :

viewer.dataSources.add(Cesium.CzmlDataSource.load(’…/data/TE.czml’));

``

Unfortunately, that doesn’t work, nothing is displayed, even if the request is correctly sent.

  • With firebug, the XML tab of the request tells me:
    XML Parsing Error: not well-formed
    Location: moz-nullprincipal:{e78947ab-3961-4fc0-843e-2ac50bc33554}
    Line Number 1, Column 12:
 *                      {
-----------^*

  • With the Chrome development tool, i have:
    SyntaxError: Unexpected token , {stack: (…), message: “Unexpected token ,”}

It seems that the JSON data type is not well detected…
Maybe I missed an obvious thing, if someone has any idea, please let me know !

Regards,

EC

TE.czml (519 Bytes)

Your JSON is invalid. You have a trailing comma after the 33 on line 21.

As expected, an obvious mistake…
I corrected another error in my CZML: the first packet must be at least (as said in the CZML spec).
{
“id” : “document”,
“version” : “1.0”
},

``

Thank you Matthew, sorry for the inconvenience,

EC