MarkerCluster(options)

The marker cluster.

Construct the cluster for the markers and provide corresponding APIs for configuration of cluster result.

new MarkerCluster(options)

Parameters:
Name Type Description
options object

options for initialization

Properties
Name Type Attributes Default Description
debug bool <optional>

whether to print the debug info

sandbox Sandbox

the sandbox where the markercluster is applied

earth Earth

sandbox's alias

config object <optional>
{method: 'default'}

the configuration of cluster method and parameters

clustersTagReserve number <optional>
25

number of clustersTag reserved for visualizing the clustering result

Methods

static add()

Add marker to the cluster.

Example

Add marker to cluster

 let tag = new altizure.TagMarker({
    sandbox: sandbox,
    position: position_of_marker,
    imgUrl: the_url_of_the_image_used_by_tag,
    scale: 1
  })
  cluster_instance.add(tag)

static clustering()

Generate the clusters of this markercluster instance.

Example

Generate clusters

 cluster_instance.clustering().then((clusters) => {
     // operation to the clusters result
   })

static disable()

Disable the visualization of marker clustering.

Example

Disable visualization

 cluster_instance.disable()

static enable(enableOptions)

Visualize the result of marker clustering.

Parameters:
Name Type Description
enableOptions object
Properties
Name Type Description
adjustHeight bool

cluster label with height

Example

Visualize clustering result

 cluster_instance.clustering().then((clusters) => {
     cluster_instance.enable({})
   })

static remove()

Remove marker from the cluster.

Example

Remove marker from cluster

  cluster_instance.remove(tag)