@googlemaps/js-markerclusterer

    Class GridAlgorithm

    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.

    Index

    Constructors

    Properties

    clusters: Cluster[] = []
    gridSize: number
    maxDistance: number
    maxZoom: number
    state: { zoom: number } = ...
    viewportPadding: number = 60

    Methods

    • 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})
      }
      }

      Type Parameters

      Parameters

      • __namedParameters: T

      Returns Cluster[]

    MMNEPVFCICPMFPCPTTAAATR