Skip to main content
Cleaned up JS example
Source Link
Lindsey D
  • 24.1k
  • 5
  • 54
  • 111

UPDATE

It looks like the underlying MarkerClusterer library has been moved (and theoretically improved).

The new library can be found here...

https://github.com/googlemaps/js-markerclustererplus

Not sure how much that affects the original JavaScript example below, but it's probably still a reasonable starting point.


ORIGINAL

As Jalen mentioned in his answer, this functionality isn't (currently) built into Smart Map. However, it's very easy to add yourself...

First, you'll need to add the MarkerClusterer library to your map page. You can link to it normally, just as you would with any other JS library.

Once you've got the library installed, you'll be able to cluster your markers with code as simple as this:

var markerCluster = new MarkerClusterer(smartMap.map['smartmap-mapcanvas-1'], smartMap.marker);
var map = smartMap.map['smartmap-mapcanvas-1'];
var markers = smartMap.marker;

var markerCluster = new MarkerClusterer(map, markers);

Pretty much everything else happens automagically!


UPDATE

It looks like the underlying MarkerClusterer library has been moved (and theoretically improved).

The new library can be found here...

https://github.com/googlemaps/js-markerclustererplus

Not sure how much that affects the JS example above, but it's probably still a reasonable starting point.

As Jalen mentioned in his answer, this functionality isn't (currently) built into Smart Map. However, it's very easy to add yourself...

First, need to add the MarkerClusterer library to your map page. You can link to it normally, just as you would with any other JS library.

Once you've got the library installed, you'll be able to cluster your markers with code as simple as this:

var markerCluster = new MarkerClusterer(smartMap.map['smartmap-mapcanvas-1'], smartMap.marker);

Pretty much everything else happens automagically!


UPDATE

It looks like the underlying MarkerClusterer library has been moved (and theoretically improved).

The new library can be found here...

https://github.com/googlemaps/js-markerclustererplus

Not sure how much that affects the JS example above, but it's probably still a reasonable starting point.

UPDATE

It looks like the underlying MarkerClusterer library has been moved (and theoretically improved).

The new library can be found here...

https://github.com/googlemaps/js-markerclustererplus

Not sure how much that affects the original JavaScript example below, but it's probably still a reasonable starting point.


ORIGINAL

As Jalen mentioned in his answer, this functionality isn't (currently) built into Smart Map. However, it's very easy to add yourself...

First, you'll need to add the MarkerClusterer library to your map page. You can link to it normally, just as you would with any other JS library.

Once you've got the library installed, you'll be able to cluster your markers with code as simple as this:

var map = smartMap.map['smartmap-mapcanvas-1'];
var markers = smartMap.marker;

var markerCluster = new MarkerClusterer(map, markers);

Pretty much everything else happens automagically!

Updated link to MarkerClusterer library
Source Link
Lindsey D
  • 24.1k
  • 5
  • 54
  • 111

As Jalen mentioned in his answer, this functionality isn't (currently) built into Smart Map. However, it's very easy to add yourself...

First, need to add the MarkerClusterer libraryMarkerClusterer library to your map page. You can link to it normally, just as you would with any other JS library.

Once you've got the library installed, you'll be able to cluster your markers with code as simple as this:

var markerCluster = new MarkerClusterer(smartMap.map['smartmap-mapcanvas-1'], smartMap.marker);

Pretty much everything else happens automagically!


UPDATE

It looks like the underlying MarkerClusterer library has been moved (and theoretically improved).

The new library can be found here...

https://github.com/googlemaps/js-markerclustererplus

Not sure how much that affects the JS example above, but it's probably still a reasonable starting point.

As Jalen mentioned in his answer, this functionality isn't (currently) built into Smart Map. However, it's very easy to add yourself...

First, need to add the MarkerClusterer library to your map page. You can link to it normally, just as you would with any other JS library.

Once you've got the library installed, you'll be able to cluster your markers with code as simple as this:

var markerCluster = new MarkerClusterer(smartMap.map['smartmap-mapcanvas-1'], smartMap.marker);

Pretty much everything else happens automagically!

As Jalen mentioned in his answer, this functionality isn't (currently) built into Smart Map. However, it's very easy to add yourself...

First, need to add the MarkerClusterer library to your map page. You can link to it normally, just as you would with any other JS library.

Once you've got the library installed, you'll be able to cluster your markers with code as simple as this:

var markerCluster = new MarkerClusterer(smartMap.map['smartmap-mapcanvas-1'], smartMap.marker);

Pretty much everything else happens automagically!


UPDATE

It looks like the underlying MarkerClusterer library has been moved (and theoretically improved).

The new library can be found here...

https://github.com/googlemaps/js-markerclustererplus

Not sure how much that affects the JS example above, but it's probably still a reasonable starting point.

Source Link
Lindsey D
  • 24.1k
  • 5
  • 54
  • 111

As Jalen mentioned in his answer, this functionality isn't (currently) built into Smart Map. However, it's very easy to add yourself...

First, need to add the MarkerClusterer library to your map page. You can link to it normally, just as you would with any other JS library.

Once you've got the library installed, you'll be able to cluster your markers with code as simple as this:

var markerCluster = new MarkerClusterer(smartMap.map['smartmap-mapcanvas-1'], smartMap.marker);

Pretty much everything else happens automagically!