Get Entity and Add to Collection via CZML Process

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

I am currently streaming and processing CZML packets with various id names. What is the correct/best way to get the entity by id and add it to the collection?

I always end up with an error such as a RunTimeError: target entity could not be resolved or

entity with id already exists in this collection.

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

Here is some of my code below - for simplification, I omitted the SSE stuff. I am successful in obtaining czml1 and it parses correctly and Cesium ingests it fine.

var czmlStream = new Cesium.CzmlDataSource();


var entSLSat1_1 = czmlStream.entities.getById(‘Satellite/XYZ’);


3. Context. Why do you need to do this? We might know a better way to accomplish your goal.

4. The Cesium version you’re using, your operating system and browser.

The getById function should just return undefined if it’s not in the collection. You could check if it’s undefined before adding it to the new collection, as well as check getById in the new collection, to confirm that it doesn’t already exist (and then decide whether to add it with a new name or not add it).

Does that work?