# How to implement billboard clustering without ‘datasource’

**URL:** <https://community.cesium.com/t/how-to-implement-billboard-clustering-without-datasource/6900>\
**Category:** CesiumJS\
**Created:** [May 10, 2018, 12:49pm UTC](https://community.cesium.com/t/how-to-implement-billboard-clustering-without-datasource/6900 "2018-05-10T12:49:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![wjd990307](https://avatars.discourse-cdn.com/v4/letter/w/65b543/32.png) [@wjd990307](https://community.cesium.com/u/wjd990307)\
**Post date:** [May 10, 2018, 12:49pm UTC](https://community.cesium.com/t/how-to-implement-billboard-clustering-without-datasource/6900/1 "2018-05-10T12:49:24Z")

</div>

hi all!!!  
My data is loaded for db,through the web service,not file.The format of the data is an array.So I can't set clustering by datasource.

code show as below:  
var billboards = this.viewer.scene.primitives.add(new Cesium.BillboardCollection());  
&nbsp;&nbsp;&nbsp;&nbsp;$.ajax({  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;type: "GET",  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;url: "[http://localhost:8099/source/getAll](http://localhost:8099/source/getAll)",  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dataType: "json",  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;success: function (data) {  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;poiListPt = data;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for (var i=0;i\<poiListPt.length;i++) {  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var pointCoor = poiListPt[i].point.substring(9,data[0].point.length-1).split(' ');  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var longitude = pointCoor[0];  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var latitude = pointCoor[1];  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var height = pointCoor[2];  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var pos = Cesium.Cartesian3.fromDegrees(longitude,latitude,height);  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var pointBillboard = billboards.add({  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;position : pos,  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;image : './images/default1.png',  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;scale : 0.8,  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;});  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}  
//but it doesn't work  
billboards.clustering.enabled = true;

---

<div class="post-metadata">

**Author:** ![Gabby\_Getz](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/gabby_getz/32/7838_2.png) [@Gabby\_Getz](https://community.cesium.com/u/Gabby_Getz)\
**Post date:** [May 15, 2018, 6:53pm UTC](https://community.cesium.com/t/how-to-implement-billboard-clustering-without-datasource/6900/2 "2018-05-15T18:53:59Z")

</div>

Hi there,

Clustering isn’t an option with a primitive **[BillboardCollection](https://cesiumjs.org/Cesium/Build/Documentation/BillboardCollection.html)**. You can still create a [**CustomDataSource**](https://cesiumjs.org/Cesium/Build/Documentation/CustomDataSource.html?classFilter=dataS) and add billboard entities, then set the clustering of that object.

Thanks,

Gabby
