Most efficient way to handle mixed data sources

I have a scenario where I have to visualize a large set of objects, each of which contains many entities, and those entities come from different sources. For example, I may have EntityCollection1, which contains 10 entities: 4 from CZML, 4 from KML, and 2 manually created entities. EntityCollection2 might have 300 entities, again with mixed sources. The EntityCollections are also dynamically updated via external sources and therefore have to be periodically updated or cleared entirely and re-created.

Is the best way to do something like the following?

- Create and store a new CZMLDataSource and KMLDataSource for every one of my many EntityCollections
- Call load() on each one and retrieve their respective entity collections
- Add the entities from each one of those collections to a single EntityCollection, including any manually created entities
- Add this merged EntityCollection into a master CompositeEntityCollection

Note that once the entities are created, I don't really care where they came from (so there is no logical difference for my situation between those created via KML or CZML or manually once I have my collection created). Therefore, I'd rather not keep them separated by DataSource if I don't have to, I'd prefer they're all merged to a single EntityCollection. I also know that creating many DataSources can be inefficient, so I was hoping to minimize that if possible.


Hi Di,

It most cases, it’s optimal to simply leave them as individual data sources. This is especially true if the data sources are geographically separated or if some data sources change while others remain static. If you are having specific performance issues with this approach, let us know, but in the general case, it’s the way to go.

If for ease of use purposes, you would like to aggregate all of your data sources into a CompositeEntityCollection for easy lookup, that’s fine. It’s probably something we should even offer out of the box at some point.