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.



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.


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.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.