Track czml polyline

Hi there,

I have a CZML file that contains 1 polyline entity following this structure

        id: "document",
        name: "Geometries",
        version: "1.0"
        id: "line_1",
        name: "line 1"
            cartographicDegrees: [lat1,lon1,alt1,lat2....]

What I have in my render.js.

 const source = new Cesium.CzmlDataSource()
 const promise = dataSource.load(czmlUrl) //
 promise.then(v => v.trackedEntity = v.entities.getById("line_1")

The line is rendered, but it is not focused. One solution that I came up with is to extract 1 set of lat, lon and alt then create an entity for “trackedEntity” or use the three points to “lookAt”. But I don’t really want to have a czml reader in the render.js. Is there any other way to solve this issue?


I think you are trying to set trackedEntity to the wrong object.
Could you try the code below?
promise.then(v => viewer.trackedEntity = v.entities.getById("line_1"))