Get DataSource by Id

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

Trying to get a datasource by id, similar to how entities can be gotten by id.

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

I know var dss = viewer.dataSources; gets all of the data sources, but I just want to get one of them. I have the ID of one of the entities created by the czml import, but how do I get this entity? I do not believe it is listed under viewer.entities.

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

Trying to get an entity created by a data source by only having the id of one of the entities created by the czml import.

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

Cesium 1.47, Centos, Firefox

If I understand your question correctly, you’ve got some datasources from CZML, and one of those contains an entity with a certain ID, and you want to find which datasource that is?

One thing you could do is iterate over each datasource and then check if it has this entity. For example, to get the entity with ID “1” from the first datasource in the list you would do:

viewer.dataSources.get(0).entities.getById(“1”)

``

If the entity doesn’t exist in that datasource this will return undefined.