Z-Order of Primitives and Data Sources?

Curious if there is a way to set the z-order between primitives and data sources? I see in the docs that each collection has the ability to order within the collection but there doesn’t appear to be a way to order across collections…

For example, if I wanted to raise/lower all primitives within the scene primitives collection above or below a data source within the viewer datasources collection I’m not see a way to do this… Am I missing something?

Currently using Cesium v1.48…

Hey Jason,

I believe you can order ground geometry types (https://cesiumjs.org/Cesium/Build/Apps/Sandcastle/?src=Z-Indexing%20Geometry.html&label=Geometries) as well as ground geometry in one datasource over all ground geometry in another datasource (https://cesiumjs.org/Cesium/Build/Apps/Sandcastle/?src=DataSource%20Ordering.html&label=DataSources). I don’t think there’s currently a way to order between primitives and datasources

Can you describe a bit more about your application? There might be an easier to structure this. For example is this something that could be done with entities instead of primitives?

We are providing users with the ability to draw their own geometries (i.e., points, polygons, etc) which essentially get drawn as primitives. Those primitives are added to various collections (i.e., BillboardCollection, LabelCollection, etc).

We also have streaming CZML coming from the server which are added as data sources.

Essentially I’m looking for a way to z-order the various collections/data sources.

So it looks like because primitives are a lower level API, there’s no method for ordering across those collections.

What you could do instead is create an entity, add it to a datasource and then you can freely order, like in this example.

I know you said the users are drawing their own geometry, but you should be able to use the Entity API for that as well (here’s a drawing example on Sandcastle https://cesiumjs.org/Cesium/Build/Apps/Sandcastle/?src=Drawing%20on%20Terrain.html ) If there’s something in the Entity API that makes it harder to do what you’re doing please let me know and we can get it on our list to fix!

Perhaps you could add the ability to order across all collection types? Primitive collections, entity collections and data sources. Currently, primitive collections allow for ordering and data sources allow for ordering indipendently so it seems reasonable that one should be able to order across all collections (i.e., primitives, entities and data sources)…