Get entities in a picked cluster

665 views
Skip to first unread message

TDenis

unread,
May 6, 2017, 5:11:54 PM5/6/17
to cesium-dev
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!

tsti...@expression.net

unread,
May 10, 2017, 2:52:23 PM5/10/17
to cesium-dev, denis.t...@gmail.com
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?

TDenis

unread,
May 10, 2017, 3:14:04 PM5/10/17
to cesium-dev, denis.t...@gmail.com, tsti...@expression.net
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.

Rachel Hwang

unread,
May 10, 2017, 4:32:26 PM5/10/17
to cesium-dev, denis.t...@gmail.com, tsti...@expression.net
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 


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

Mohamad Moneimne

unread,
Jun 2, 2017, 11:16:34 AM6/2/17
to cesium-dev, denis.t...@gmail.com
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
Reply all
Reply to author
Forward
0 new messages