# Class: MarkerClusterer

## MarkerClusterer

#### new MarkerClusterer(map [, opt_markers] [, opt_options])

  Creates a MarkerClusterer object with the options specified in MarkerClustererOptions.

  ##### Parameters:

  Name | Type | Argument | Description
  --- | --- | --- | ---
  `map` | google.maps.Map |  | The Google map to attach to.
  `opt_markers` | Array.<google.maps.Marker> | <optional> | The markers to be added to the cluster.
  `opt_options` | MarkerClustererOptions | <optional> | The optional parameters.

  Source:
    - utils/v3-utility-library-master/markerclustererplus/src/markerclusterer.js, line 625

### Extends

- google.maps.OverlayView

### Members

#### <static, constant> BATCH_SIZE :number

  The number of markers to process in one batch.

  ##### Type:

  - number
  Source:
    - utils/v3-utility-library-master/markerclustererplus/src/markerclusterer.js, line 1558

#### <static, constant> BATCH_SIZE_IE :number

  The number of markers to process in one batch (IE only).

  ##### Type:

  - number
  Source:
    - utils/v3-utility-library-master/markerclustererplus/src/markerclusterer.js, line 1567

#### <static, constant> IMAGE_EXTENSION :string

  The default extension name for the marker cluster images.

  ##### Type:

  - string
  Source:
    - utils/v3-utility-library-master/markerclustererplus/src/markerclusterer.js, line 1585

#### <static, constant> IMAGE_PATH :string

  The default root name for the marker cluster images.

  ##### Type:

  - string
  Source:
    - utils/v3-utility-library-master/markerclustererplus/src/markerclusterer.js, line 1576

#### <static, constant> IMAGE_SIZES :Array.<number>

  The default array of sizes for the marker cluster images.

  ##### Type:

  - Array.<number>
  Source:
    - utils/v3-utility-library-master/markerclustererplus/src/markerclusterer.js, line 1594

### Methods

#### addMarker(marker [, opt_nodraw])

  Adds a marker to the clusterer. The clusters are redrawn unless
  `opt_nodraw` is set to `true`.

  ##### Parameters:

  Name | Type | Argument | Description
  --- | --- | --- | ---
  `marker` | google.maps.Marker |  | The marker to add.
  `opt_nodraw` | boolean | <optional> | Set to `true` to prevent redrawing.

  Source:
    - utils/v3-utility-library-master/markerclustererplus/src/markerclusterer.js, line 1137

#### addMarkers(markers [, opt_nodraw])

  Adds an array of markers to the clusterer. The clusters are redrawn unless
  `opt_nodraw` is set to `true`.

  ##### Parameters:

  Name | Type | Argument | Description
  --- | --- | --- | ---
  `markers` | Array.<google.maps.Marker> |  | The markers to add.
  `opt_nodraw` | boolean | <optional> | Set to `true` to prevent redrawing.

  Source:
    - utils/v3-utility-library-master/markerclustererplus/src/markerclusterer.js, line 1152

#### addToClosestCluster_(marker)

  Adds a marker to a cluster, or creates a new cluster.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `marker` | google.maps.Marker | The marker to add.

  Source:
    - utils/v3-utility-library-master/markerclustererplus/src/markerclusterer.js, line 1403

#### clearMarkers()

  Removes all clusters and markers from the map and also removes all markers
  managed by the clusterer.

  Source:
    - utils/v3-utility-library-master/markerclustererplus/src/markerclusterer.js, line 1267

#### createClusters_(iFirst)

  Creates the clusters. This is done in batches to avoid timeout errors
  in some browsers when there is a huge number of markers.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `iFirst` | number | The index of the first marker in the batch of markers to be added to clusters.

  Source:
    - utils/v3-utility-library-master/markerclustererplus/src/markerclusterer.js, line 1436

#### distanceBetweenPoints_(p1, p2)

  Calculates the distance between two latlng locations in km.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `p1` | google.maps.LatLng | The first lat lng point.
  `p2` | google.maps.LatLng | The second lat lng point.

  Source:
    - utils/v3-utility-library-master/markerclustererplus/src/markerclusterer.js, line 1373
  See:
    - http://www.movable-type.co.uk/scripts/latlong.html

  ##### Returns:

  The distance between the two points in km.

  Type
    number

#### fitMapToMarkers()

  Fits the map to the bounds of the markers managed by the clusterer.

  Source:
    - utils/v3-utility-library-master/markerclustererplus/src/markerclusterer.js, line 778

#### getAverageCenter()

  Returns the value of the `averageCenter` property.

  Source:
    - utils/v3-utility-library-master/markerclustererplus/src/markerclusterer.js, line 914

  ##### Returns:

  True if averageCenter property is set.

  Type
    boolean

#### getBatchSizeIE()

  Returns the value of the `batchSizeIE` property.

  Source:
    - utils/v3-utility-library-master/markerclustererplus/src/markerclusterer.js, line 1055

  ##### Returns:

  the value of the batchSizeIE property.

  Type
    number

#### getCalculator()

  Returns the value of the `calculator` property.

  Source:
    - utils/v3-utility-library-master/markerclustererplus/src/markerclusterer.js, line 1034

  ##### Returns:

  the value of the calculator property.

  Type
    function

#### getClusterClass()

  Returns the value of the `clusterClass` property.

  Source:
    - utils/v3-utility-library-master/markerclustererplus/src/markerclusterer.js, line 1075

  ##### Returns:

  the value of the clusterClass property.

  Type
    string

#### getClusters()

  Returns the current array of clusters formed by the clusterer.

  Source:
    - utils/v3-utility-library-master/markerclustererplus/src/markerclusterer.js, line 1115

  ##### Returns:

  The array of clusters formed by the clusterer.

  Type
    Array

#### getEnableRetinaIcons()

  Returns the value of the `enableRetinaIcons` property.

  Source:
    - utils/v3-utility-library-master/markerclustererplus/src/markerclusterer.js, line 954

  ##### Returns:

  True if enableRetinaIcons property is set.

  Type
    boolean

#### getGridSize()

  Returns the value of the `gridSize` property.

  Source:
    - utils/v3-utility-library-master/markerclustererplus/src/markerclusterer.js, line 795

  ##### Returns:

  The grid size.

  Type
    number

#### getIgnoreHidden()

  Returns the value of the `ignoreHidden` property.

  Source:
    - utils/v3-utility-library-master/markerclustererplus/src/markerclusterer.js, line 934

  ##### Returns:

  True if ignoreHidden property is set.

  Type
    boolean

#### getImageExtension()

  Returns the value of the `imageExtension` property.

  Source:
    - utils/v3-utility-library-master/markerclustererplus/src/markerclusterer.js, line 974

  ##### Returns:

  The value of the imageExtension property.

  Type
    string

#### getImagePath()

  Returns the value of the `imagePath` property.

  Source:
    - utils/v3-utility-library-master/markerclustererplus/src/markerclusterer.js, line 994

  ##### Returns:

  The value of the imagePath property.

  Type
    string

#### getImageSizes()

  Returns the value of the `imageSizes` property.

  Source:
    - utils/v3-utility-library-master/markerclustererplus/src/markerclusterer.js, line 1014

  ##### Returns:

  The value of the imageSizes property.

  Type
    Array

#### getMarkers()

  Returns the array of markers managed by the clusterer.

  Source:
    - utils/v3-utility-library-master/markerclustererplus/src/markerclusterer.js, line 1095

  ##### Returns:

  The array of markers managed by the clusterer.

  Type
    Array

#### getMaxZoom()

  Returns the value of the `maxZoom` property.

  Source:
    - utils/v3-utility-library-master/markerclustererplus/src/markerclusterer.js, line 834

  ##### Returns:

  The maximum zoom level.

  Type
    number

#### getMinimumClusterSize()

  Returns the value of the `minimumClusterSize` property.

  Source:
    - utils/v3-utility-library-master/markerclustererplus/src/markerclusterer.js, line 815

  ##### Returns:

  The minimum cluster size.

  Type
    number

#### getStyles()

  Returns the value of the `styles` property.

  Source:
    - utils/v3-utility-library-master/markerclustererplus/src/markerclusterer.js, line 854

  ##### Returns:

  The array of styles defining the cluster markers to be used.

  Type
    Array

#### getTitle()

  Returns the value of the `title` property.

  Source:
    - utils/v3-utility-library-master/markerclustererplus/src/markerclusterer.js, line 874

  ##### Returns:

  The content of the title text.

  Type
    string

#### getTotalClusters()

  Returns the number of clusters formed by the clusterer.

  Source:
    - utils/v3-utility-library-master/markerclustererplus/src/markerclusterer.js, line 1125

  ##### Returns:

  The number of clusters formed by the clusterer.

  Type
    number

#### getTotalMarkers()

  Returns the number of markers managed by the clusterer.

  Source:
    - utils/v3-utility-library-master/markerclustererplus/src/markerclusterer.js, line 1105

  ##### Returns:

  The number of markers.

  Type
    number

#### getZoomOnClick()

  Returns the value of the `zoomOnClick` property.

  Source:
    - utils/v3-utility-library-master/markerclustererplus/src/markerclusterer.js, line 894

  ##### Returns:

  True if zoomOnClick property is set.

  Type
    boolean

#### isMarkerInBounds_(marker, bounds)

  Determines if a marker is contained in a bounds.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `marker` | google.maps.Marker | The marker to check.
  `bounds` | google.maps.LatLngBounds | The bounds to check against.

  Source:
    - utils/v3-utility-library-master/markerclustererplus/src/markerclusterer.js, line 1393

  ##### Returns:

  True if the marker is in the bounds.

  Type
    boolean

#### pushMarkerTo_(marker)

  Pushes a marker to the clusterer.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `marker` | google.maps.Marker | The marker to add.

  Source:
    - utils/v3-utility-library-master/markerclustererplus/src/markerclusterer.js, line 1170

#### redraw_()

  Redraws all the clusters.

  Source:
    - utils/v3-utility-library-master/markerclustererplus/src/markerclusterer.js, line 1334

#### removeMarker(marker [, opt_nodraw])

  Removes a marker from the cluster. The clusters are redrawn unless
  `opt_nodraw` is set to `true`. Returns `true` if the
  marker was removed from the clusterer.

  ##### Parameters:

  Name | Type | Argument | Description
  --- | --- | --- | ---
  `marker` | google.maps.Marker |  | The marker to remove.
  `opt_nodraw` | boolean | <optional> | Set to `true` to prevent redrawing.

  Source:
    - utils/v3-utility-library-master/markerclustererplus/src/markerclusterer.js, line 1195

  ##### Returns:

  True if the marker was removed from the clusterer.

  Type
    boolean

#### removeMarker_(marker)

  Removes a marker and returns true if removed, false if not.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `marker` | google.maps.Marker | The marker to remove

  Source:
    - utils/v3-utility-library-master/markerclustererplus/src/markerclusterer.js, line 1238

  ##### Returns:

  Whether the marker was removed or not

  Type
    boolean

#### removeMarkers(markers [, opt_nodraw])

  Removes an array of markers from the cluster. The clusters are redrawn unless
  `opt_nodraw` is set to `true`. Returns `true` if markers
  were removed from the clusterer.

  ##### Parameters:

  Name | Type | Argument | Description
  --- | --- | --- | ---
  `markers` | Array.<google.maps.Marker> |  | The markers to remove.
  `opt_nodraw` | boolean | <optional> | Set to `true` to prevent redrawing.

  Source:
    - utils/v3-utility-library-master/markerclustererplus/src/markerclusterer.js, line 1215

  ##### Returns:

  True if markers were removed from the clusterer.

  Type
    boolean

#### repaint()

  Recalculates and redraws all the marker clusters from scratch.
  Call this after changing any properties.

  Source:
    - utils/v3-utility-library-master/markerclustererplus/src/markerclusterer.js, line 1277

#### resetViewport_( [opt_hide])

  Removes all clusters from the map. The markers are also removed from the map
  if `opt_hide` is set to `true`.

  ##### Parameters:

  Name | Type | Argument | Description
  --- | --- | --- | ---
  `opt_hide` | boolean | <optional> | Set to `true` to also remove the markers from the map.

  Source:
    - utils/v3-utility-library-master/markerclustererplus/src/markerclusterer.js, line 1346

#### setAverageCenter(averageCenter)

  Sets the value of the `averageCenter` property.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `averageCenter` | boolean | The value of the averageCenter property.

  Source:
    - utils/v3-utility-library-master/markerclustererplus/src/markerclusterer.js, line 924

#### setBatchSizeIE(batchSizeIE)

  Sets the value of the `batchSizeIE` property.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `batchSizeIE` | number | The value of the batchSizeIE property.

  Source:
    - utils/v3-utility-library-master/markerclustererplus/src/markerclusterer.js, line 1065

#### setCalculator(calculator)

  Sets the value of the `calculator` property.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `calculator` | function | The value of the calculator property.

  Source:
    - utils/v3-utility-library-master/markerclustererplus/src/markerclusterer.js, line 1045

#### setClusterClass(clusterClass)

  Sets the value of the `clusterClass` property.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `clusterClass` | string | The value of the clusterClass property.

  Source:
    - utils/v3-utility-library-master/markerclustererplus/src/markerclusterer.js, line 1085

#### setEnableRetinaIcons(enableRetinaIcons)

  Sets the value of the `enableRetinaIcons` property.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `enableRetinaIcons` | boolean | The value of the enableRetinaIcons property.

  Source:
    - utils/v3-utility-library-master/markerclustererplus/src/markerclusterer.js, line 964

#### setGridSize(gridSize)

  Sets the value of the `gridSize` property.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `gridSize` | number | The grid size.

  Source:
    - utils/v3-utility-library-master/markerclustererplus/src/markerclusterer.js, line 805

#### setIgnoreHidden(ignoreHidden)

  Sets the value of the `ignoreHidden` property.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `ignoreHidden` | boolean | The value of the ignoreHidden property.

  Source:
    - utils/v3-utility-library-master/markerclustererplus/src/markerclusterer.js, line 944

#### setImageExtension(imageExtension)

  Sets the value of the `imageExtension` property.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `imageExtension` | string | The value of the imageExtension property.

  Source:
    - utils/v3-utility-library-master/markerclustererplus/src/markerclusterer.js, line 984

#### setImagePath(imagePath)

  Sets the value of the `imagePath` property.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `imagePath` | string | The value of the imagePath property.

  Source:
    - utils/v3-utility-library-master/markerclustererplus/src/markerclusterer.js, line 1004

#### setImageSizes(imageSizes)

  Sets the value of the `imageSizes` property.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `imageSizes` | Array | The value of the imageSizes property.

  Source:
    - utils/v3-utility-library-master/markerclustererplus/src/markerclusterer.js, line 1024

#### setMaxZoom(maxZoom)

  Sets the value of the `maxZoom` property.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `maxZoom` | number | The maximum zoom level.

  Source:
    - utils/v3-utility-library-master/markerclustererplus/src/markerclusterer.js, line 844

#### setMinimumClusterSize(minimumClusterSize)

  Sets the value of the `minimumClusterSize` property.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `minimumClusterSize` | number | The minimum cluster size.

  Source:
    - utils/v3-utility-library-master/markerclustererplus/src/markerclusterer.js, line 824

#### setStyles(styles)

  Sets the value of the `styles` property.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `styles` | Array.<ClusterIconStyle> | The array of styles to use.

  Source:
    - utils/v3-utility-library-master/markerclustererplus/src/markerclusterer.js, line 864

#### setTitle(title)

  Sets the value of the `title` property.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `title` | string | The value of the title property.

  Source:
    - utils/v3-utility-library-master/markerclustererplus/src/markerclusterer.js, line 884

#### setupStyles_()

  Sets up the styles object.

  Source:
    - utils/v3-utility-library-master/markerclustererplus/src/markerclusterer.js, line 758

#### setZoomOnClick(zoomOnClick)

  Sets the value of the `zoomOnClick` property.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `zoomOnClick` | boolean | The value of the zoomOnClick property.

  Source:
    - utils/v3-utility-library-master/markerclustererplus/src/markerclusterer.js, line 904

### Events

#### click

  This event is fired when a cluster marker is clicked.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `c` | Cluster | The cluster that was clicked.

  Source:
    - utils/v3-utility-library-master/markerclustererplus/src/markerclusterer.js, line 106

#### clusteringbegin

  This event is fired when the `MarkerClusterer` begins
  clustering markers.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `mc` | MarkerClusterer | The MarkerClusterer whose markers are being clustered.

  Source:
    - utils/v3-utility-library-master/markerclustererplus/src/markerclusterer.js, line 1446

#### clusteringend

  This event is fired when the `MarkerClusterer` stops
  clustering markers.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `mc` | MarkerClusterer | The MarkerClusterer whose markers are being clustered.

  Source:
    - utils/v3-utility-library-master/markerclustererplus/src/markerclusterer.js, line 1491

#### mouseout

  This event is fired when the mouse moves out of a cluster marker.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `c` | Cluster | The cluster that the mouse moved out of.

  Source:
    - utils/v3-utility-library-master/markerclustererplus/src/markerclusterer.js, line 153

#### mouseover

  This event is fired when the mouse moves over a cluster marker.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `c` | Cluster | The cluster that the mouse moved over.

  Source:
    - utils/v3-utility-library-master/markerclustererplus/src/markerclusterer.js, line 142

#### Search results