# Get entities in a picked cluster

**URL:** <https://community.cesium.com/t/get-entities-in-a-picked-cluster/5491>\
**Category:** CesiumJS\
**Created:** [May 6, 2017, 9:11pm UTC](https://community.cesium.com/t/get-entities-in-a-picked-cluster/5491 "2017-05-06T21:11:54Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![TDenis](https://avatars.discourse-cdn.com/v4/letter/t/c77e96/32.png) [@TDenis](https://community.cesium.com/u/TDenis)\
**Post date:** [May 6, 2017, 9:11pm UTC](https://community.cesium.com/t/get-entities-in-a-picked-cluster/5491/1 "2017-05-06T21:11:54Z")

</div>

Hello all!  
When a user clicks a map, I use scene.drillPick method to get a list of objects with appropriate entities in id field. This works great for simple points and polygons.  
But now I am trying to enable clustering for my points, and I'd like to get a list of contained entities when a user clicks a cluster. Is it possible?  
drillPick returns an object, but it's id field is set to "undefined". Two other fields - collection and primitive - contains some data, but I can't find a way to get clustered entities via these fields.  
Google didn't help either.  
Thanks in advance!

---

<div class="post-metadata">

**Author:** ![tstilwell](https://avatars.discourse-cdn.com/v4/letter/t/ad7895/32.png) [@tstilwell](https://community.cesium.com/u/tstilwell)\
**Post date:** [May 10, 2017, 6:52pm UTC](https://community.cesium.com/t/get-entities-in-a-picked-cluster/5491/2 "2017-05-10T18:52:23Z")

</div>

I'd also like to second this question. Some of our data has multiple entities at the same position, and clustering is essential to identify these positions/entities, in addition to prettifying the display. I've tried numerous methods: exploring if it requires adding a separate datasource for the clustered billboards, delving into the 'collection' and 'primitive' objects of each billboard that's clicked (as TDenis noted above), and worst case was going to try to create a rectangle for each clicked position to determine if there are individual entities within the rectangle.

One thing I noticed was that if you click an "un-clustered" entity, it's 'collection' property seems to reference the entityCluster's \_clusterPointCollection AND \_pointCollection. Whereas if you click the billboard for a clustered entity, it's collection property references the entityCluster's \_clusterBillboardCollection and \_billboardCollection -- but the \_billboardCollection shows as 'undefined'.

Is some billboard collection not initialized that needs to be?

Main question as TDenis noted is why the billboard selection has an undefined id?

---

<div class="post-metadata">

**Author:** ![TDenis](https://avatars.discourse-cdn.com/v4/letter/t/c77e96/32.png) [@TDenis](https://community.cesium.com/u/TDenis)\
**Post date:** [May 10, 2017, 7:14pm UTC](https://community.cesium.com/t/get-entities-in-a-picked-cluster/5491/3 "2017-05-10T19:14:04Z")

</div>

Found a couple options here.  
First, you can set cluster.billboard.id in a "clusterEvent" listener. That object can be found in picked object's id field.  
Second, looks like picked object's primitive field contains a cluster.billboard object specified in a "clusterEvent" listener. So in that listener we can just add custom fields to billboard and put some data there.

---

<div class="post-metadata">

**Author:** ![Rachel\_Hwang](https://avatars.discourse-cdn.com/v4/letter/r/d78d45/32.png) [@Rachel\_Hwang](https://community.cesium.com/u/Rachel_Hwang)\
**Post date:** [May 10, 2017, 8:32pm UTC](https://community.cesium.com/t/get-entities-in-a-picked-cluster/5491/4 "2017-05-10T20:32:26Z")

</div>

Looks like you found a bug! The object returned from scene.pick should have an id field that is an array of the clustered entities. There was an issue opened for this recently:  
[https://github.com/AnalyticalGraphicsInc/cesium/issues/5286](https://github.com/AnalyticalGraphicsInc/cesium/issues/5286)

I’ve linked to this thread so we can notify you when we get a chance to fix it. However, if you’re interested, you’re welcome to give it a try! I’ve be happen to provide guidance on making a contribution.

Best,

- Rachel

---

<div class="post-metadata">

**Author:** ![Mohamad\_Moneimne](https://avatars.discourse-cdn.com/v4/letter/m/bbce88/32.png) [@Mohamad\_Moneimne](https://community.cesium.com/u/Mohamad_Moneimne)\
**Post date:** [June 2, 2017, 3:16pm UTC](https://community.cesium.com/t/get-entities-in-a-picked-cluster/5491/5 "2017-06-02T15:16:34Z")

</div>

This bug has been fixed and will be included in the 1.35 release coming out on July 5th.

Hope this helps you move forward with your work!

- Mohamad
