I started to work with Craft CMS a couple month ago, I have a client that wants to have a clustered map, I went over Smart Map documentation but I couldn't find anything about on how to add Google MarkerClusterer library.
2 Answers
UPDATE
It looks like the underlying MarkerClusterer library has been moved (and theoretically improved).
The new library can be found here...
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!
I don't believe Smart Map currently offers that functionality. I'd recommend opening an issue with your feature request over at https://github.com/doublesecretagency/craft-smartmap.
-
1Surprised it took this long, but somebody finally went and did it... :) Commented Jan 4, 2021 at 18:57