MarkerClusterer for Google Maps v3

The library creates and manages per-zoom-level clusters for large amounts of markers.
This is a v3 implementation of the v2 MarkerClusterer.

For a description and examples of how to use this library, check out the how-to.

class MarkerClusterer

This class extends google.maps.OverlayView.

Constructor

Constructor Description
MarkerClusterer(map:google.maps.Map, opt_markers:Array.<google.maps.Marker>, opt_options:Object) A Marker Clusterer that clusters markers.

Methods

Methods Return Value Description
addMarker(marker:google.maps.Marker, opt_nodraw:boolean) None Adds a marker to the clusterer and redraws if needed.
addMarkers(markers:Array.<google.maps.Marker>, opt_nodraw:boolean) None Adds an array of markers to the clusterer.
clearMarkers() None Clears all clusters and markers from the clusterer.
getCalculator() function(Array|number) Gets the calculator function.
getExtendedBounds(bounds:google.maps.LatLngBounds) google.maps.LatLngBounds Extends a bounds object by the grid size.
getGridSize() number Gets the size of the grid.
getMap() google.maps.Map Gets the google map that the clusterer is associated with.
getMarkers() Array. Gets the array of markers in the clusterer.
getMaxZoom() number Gets the max zoom for the clusterer.
getStyles() Object Gets the styles.
getTotalClusters() number Gets the number of clusters in the clusterer.
getTotalMarkers() Array. Gets the array of markers in the clusterer.
isZoomOnClick() boolean Whether zoom on click is set.
redraw() None Redraws the clusters.
removeMarker(marker:google.maps.Marker) boolean Removes a marker from the cluster.
resetViewport() None Clears all existing clusters and recreates them.
setCalculator(calculator:function(Array|number)) None Sets the calculator function.
setGridSize(size:number) None Sets the size of the grid.
setMap(map:google.maps.Map) None Sets the google map that the clusterer is associated with.
setMaxZoom(maxZoom:number) None Sets the max zoom for the clusterer.
setStyles(styles:Object) None Sets the styles.