Load Multiple CZML Files

It’s posible to load multiple czml files to the cesium viewer?

Yes it is. Just create as many CzmlDataSource objects as you have files.

I am facing the same issue: trying to display two CZML files, but only found that the second one always being wiped the first one, so only the last czml file got displayed. Below is my code. Did I missing something? Thanks.

            promise1 = Cesium.CzmlDataSource.load("./SampleData/sats.czml");
            promise1.then((czmlData) => {
                    m_czmlDataSource = czmlData;
                    viewer.dataSources.add(czmlData);
                    viewer.zoomTo(czmlData);
                }
            );
            promise2 = Cesium.CzmlDataSource.load("./SampleData/vehicle.czml");
            promise2.then((czmlData) => {
                    m_czmlDataSource = czmlData;
                    viewer.dataSources.add(czmlData);
                    viewer.zoomTo(czmlData);
                }
            );

Are the availability intervals the same for both files? If not, it could appear that only the last loaded file is being shown.

I’ve created two CZML files that don’t specify availability times and both are shown using the same code as you.

1 Like