Creates collapsible groups of Markers, Sprites or Images.
Example: Multi-Level Clustering
Load the file /modules/miniature.earth.clustering.js or copy the code to your script and customize it to your needs.
Enable clustering for this earth.
myearth.addEventListener( "ready", function() {
Earth.Clustering.enable( this );
/* add your objects and cluster them */
} );
var my_cluster_marker = myearth.addMarker( {
mesh : "Pin3",
hotspot : true
} );
var child1 = myearth.addMarker( {
mesh : "Pin3",
location : { lat: -25, lng: 14 },
scale: 0.6
} );
var child2 = myearth.addMarker( {
mesh : "Pin3",
location : { lat: -21, lng: 10 },
scale: 0.6
} );
myearth.cluster( my_cluster_marker, [child1, child2] );
Collapses all clusters.
myearth.collapseAll();
Shows the children of this cluster.
my_cluster_marker.expand();
Hides the children of this cluster.
my_cluster_marker.collapse();