Clustering with HTML overlays

Hi everyone,
I’m using the HTML overlay as in this Sandcastle.
Say I have hundreds of them. It is obvious they will overlap and have some zones with excessive density of overlays.

Is it possible to apply the clustering algorithm to them?

Thank you

You could do this if your overlays were billboards instead, like in this demo:

You could potentially have “invisible” billboards that cluster, and then listen for the clustering event(s) and apply that to your HTML overlays.

Otherwise, you’d have to implement some custom clustering logic in your app. The simplest thing could just be making them disappear/change size based on distance to the camera.

Ok thanks, I’ll try with billboards.
I was using html overlays because I need to open a html modal with the clicked element details.
Can I do it with billboards?

Thank you

By default, clicking on billboards will open an infobox with that entity’s description information in there, but you can override this behavior. You can use scene.pick() to get the entity underneath the mouse, and then the billboard can have some custom property on it for whatever link you’d like to open.

Thank you, I’ll switch to billboards then