English | 简体中文

EntityCluster

new Cesium.EntityCluster(options)

Defines how screen space objects (billboards, points, labels) are clustered.
Name Type Description
options object optional An object with the following properties:
Name Type Default Description
enabled boolean false optional Whether or not to enable clustering.
pixelRange number 80 optional The pixel range to extend the screen space bounding box.
minimumClusterSize number 2 optional The minimum number of screen space objects that can be clustered.
clusterBillboards boolean true optional Whether or not to cluster the billboards of an entity.
clusterLabels boolean true optional Whether or not to cluster the labels of an entity.
clusterPoints boolean true optional Whether or not to cluster the points of an entity.
show boolean true optional Determines if the entities in the cluster will be shown.
Demo:

Members

Gets or sets whether clustering billboard entities is enabled.
Gets the event that will be raised when a new cluster will be displayed. The signature of the event listener is EntityCluster.newClusterCallback.
Gets or sets whether clustering labels entities is enabled.
Gets or sets whether clustering point entities is enabled.
Gets or sets whether clustering is enabled.
Gets or sets the minimum number of screen space objects that can be clustered.
Gets or sets the pixel range to extend the screen space bounding box.
Determines if entities in this collection will be shown.
Default Value: true

Methods

Destroys the WebGL resources held by this object. Destroying an object allows for deterministic release of WebGL resources, instead of relying on the garbage collector to destroy this object.

Unlike other objects that use WebGL resources, this object can be reused. For example, if a data source is removed from a data source collection and added to another.

Type Definitions

Cesium.EntityCluster.newClusterCallback(clusteredEntities, cluster)

A event listener function used to style clusters.
Name Type Description
clusteredEntities Array.<Entity> An array of the entities contained in the cluster.
cluster object An object containing the Billboard, Label, and Point primitives that represent this cluster of entities.
Name Type Description
billboard Billboard
label Label
point PointPrimitive
Example:
// The default cluster values.
dataSource.clustering.clusterEvent.addEventListener(function(entities, cluster) {
    cluster.label.show = true;
    cluster.label.text = entities.length.toLocaleString();
});
Need help? The fastest way to get answers is from the community and team on the Cesium Forum.