Options
All
  • Public
  • Public/Protected
  • All
Menu

The default Grid algorithm historically used in Google Maps marker clustering.

The Grid algorithm does not implement caching and markers may flash as the viewport changes. Instead use SuperClusterAlgorithm.

Hierarchy

  • AbstractViewportAlgorithm
    • GridAlgorithm

Index

Constructors

Properties

clusters: Cluster[] = []
gridSize: number
maxDistance: number
maxZoom: number
viewportPadding: number = 60

Methods

  • addToClosestCluster(marker: Marker, map: Map, projection: MapCanvasProjection): void
  • Parameters

    • marker: Marker
    • map: Map
    • projection: MapCanvasProjection

    Returns void

  • Helper function to bypass clustering based upon some map state such as zoom, number of markers, etc.

     cluster({markers, map}: AlgorithmInput): Cluster[] {
    if (shouldBypassClustering(map)) {
    return this.noop({markers, map})
    }
    }

    Parameters

    Returns Cluster[]

Generated using TypeDoc