DEV Community

GreggHume
GreggHume

Posted on • Edited on

6 3

Google maps: MarkerClusterer and GridAlogrithm example

Here is an example of how to use the "@googlemaps/markerclusterer":

// ...other imports and then,
import { MarkerClusterer, GridAlgorithm } from "@googlemaps/markerclusterer";

// ... your other map code here

/* Note:
GridAlgorithm seems to be better then the default or 
standard algorithm which is SuperClusterAlgorithm
*/
const algorithm = new GridAlgorithm({
  gridSize: 60
});
new MarkerClusterer({map, markers, algorithm});
Enter fullscreen mode Exit fullscreen mode

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs