Multiple polylines (or other primitives) in one entity

Good time of a day for everybody.

I’d like to group more primitives under an Entity “umbrella” than it is allowed now by a list of Entity properties.
For example, if I wish to have two crossing lines “managed” an entity I expect the following code to work (code is ready for Sandcastle)

var viewer = new Cesium.Viewer(‘cesiumContainer’);
var position = Cesium.Cartesian3.fromDegrees(0,0,0);

var entity = viewer.entities.add({
position : position,
point : {
pixelSize : 10
polyline : {
positions : Cesium.Cartesian3.fromDegreesArray([
-1, -1,
1, 1]) ,
followSurface : false
entity.polyline1 = new Cesium.PolylineGraphics({
positions : Cesium.Cartesian3.fromDegreesArray([
-1, 1,
1, -1]) ,
followSurface : false
viewer.trackedEntity = entity;

Unfortunately only one polyline is visible - the entity native polyline.
The one that was added by custom property doesn’t show.

The question is:
is this an architectural limitation of an Entity layer and each instance on an entity is limited only to one instance of a primitive?
Or may be I miss some code to “activate” added property?


Hello Vladimir,

Yes, the Entity API is only designed to have one primitive per type per entity, so you cannot add another polyline onto the entity the way you are trying to in the code example you posted.

We do have a concept of parent entities however, and you may find it helpful to group entities that way. See this example for toggling the visibility of multiple entities by giving them a parent: