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)

Billboard image

Create up to 10 Postgres Databases on Neon's free plan.

If you're starting a new project, Neon has got your databases covered. No credit cards. No trials. No getting in your way.

Try Neon for Free →

AWS GenAI Live!

GenAI LIVE! is a dynamic live-streamed show exploring how AWS and our partners are helping organizations unlock real value with generative AI.

Tune in to the full event

DEV is partnering to bring live events to the community. Join us or dismiss this billboard if you're not interested. ❤️