# Why not EntityCollection display?

**URL:** <https://community.cesium.com/t/why-not-entitycollection-display/7733>\
**Category:** CesiumJS\
**Created:** [November 27, 2018, 9:23am UTC](https://community.cesium.com/t/why-not-entitycollection-display/7733 "2018-11-27T09:23:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![285970228](https://avatars.discourse-cdn.com/v4/letter/2/ba9def/32.png) [@285970228](https://community.cesium.com/u/285970228)\
**Post date:** [November 27, 2018, 9:23am UTC](https://community.cesium.com/t/why-not-entitycollection-display/7733/1 "2018-11-27T09:23:23Z")

</div>

The antities in the EntityCollection is not display

// My code like this, it is not work, polyline did not display.  
&nbsp;&nbsp;let areaLineCollection = new Cesium.EntityCollection()  
&nbsp;&nbsp;  
&nbsp;&nbsp;let polyline = areaLineCollection.add(new Cesium.Entity({  
&nbsp;&nbsp;&nbsp;&nbsp;polyline : {  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;width: 3,  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;positions : Cesium.Cartesian3.fromDegreesArrayHeights(temp),  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;material : Cesium.Color.YELLOW,  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;depthFailMaterial : Cesium.Color.YELLOW,  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;show: true  
&nbsp;&nbsp;&nbsp;&nbsp;}  
&nbsp;&nbsp;}));  
&nbsp;&nbsp;viewer.entities.add(areaLineCollection)

// I change my code to this, it works, the polyline display, I do not know why.

let polyline = viewer.entities.add(new Cesium.Entity({  
&nbsp;&nbsp;&nbsp;&nbsp;polyline : {  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;width: 3,  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;positions : Cesium.Cartesian3.fromDegreesArrayHeights(temp),  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;material : Cesium.Color.YELLOW,  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;depthFailMaterial : Cesium.Color.YELLOW,  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;show: true  
&nbsp;&nbsp;&nbsp;&nbsp;}  
&nbsp;&nbsp;}));  
&nbsp;&nbsp;viewer.entities.add(areaLineCollection)

---

<div class="post-metadata">

**Author:** ![omar](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/omar/32/1999_2.png) [@omar](https://community.cesium.com/u/omar)\
**Post date:** [November 30, 2018, 3:05pm UTC](https://community.cesium.com/t/why-not-entitycollection-display/7733/2 "2018-11-30T15:05:56Z")

</div>

The EntityCollection can be used when creating custom data sources (see this example: [https://cesiumjs.org/Cesium/Build/Apps/Sandcastle/?src=Custom%20DataSource.html](https://cesiumjs.org/Cesium/Build/Apps/Sandcastle/?src=Custom%20DataSource.html))

If you’re just trying to keep track of groups of your entities, I would just add them to a regular JavaScript array. Does that work for you?
