bjorn2404 / jQuery-Store-Locator-Plugin

A store locator plugin using Google Maps API version 3
MIT License
495 stars 235 forks source link

Marker cluster #33

Closed herooutoftime closed 8 years ago

herooutoftime commented 10 years ago

Would be a nice enhancement to add marker clustering ability. Had to implement a really basic approach myself but could be done far more extensive.

To apply it:

...
,'markerCluster': true
,'markerClusterStyles': [{
        url: 'cluster1.png'
        ,width: 90
        ,height: 67
        ,anchor:[11,37]
        ,textColor: '#ffffff'
    },{
        url: 'cluster2.png'
        ,width: 90
        ,height: 67
        ,anchor:[11,37]
        ,textColor: '#ffffff'
    },
...

And in the plugin itself like this:

...
if(_this.settings.markerCluster === true) {
    var markerCluster = new MarkerClusterer(map, markers, {
        'styles': _this.settings.markerClusterStyles
    });
}
...
bjorn2404 commented 10 years ago

This is something I'm going to look into for a future version. Others have asked for this as well.

ddalli commented 10 years ago

@herooutoftime -- I tried implementing your above code, in a temp. fashion before this feature is officially supported, but I'm seeing an error:

"Uncaught ReferenceError: MarkerClusterer is not defined"

Thoughts? I'd appreciate any feedback. Thanks.

ddalli commented 10 years ago

Nevermind, forgot to include markerclusterer.js -- via http://google-maps-utility-library-v3.googlecode.com/svn/trunk/markerclusterer/src/markerclusterer.js

chuck808 commented 9 years ago

Could you please let me know whereabouts this goes

... if(_this.settings.markerCluster === true) { var markerCluster = new MarkerClusterer(map, markers, { 'styles': _this.settings.markerClusterStyles }); } ...

Thanks

ddalli commented 9 years ago

@chuck808, I placed it on line 1890 in jquery.storelocator.js; however, this may differ from yours, for I have various additions/edits throughout the doc.. Nevertheless, I have it directly below the code that sets the list li background colors...

Search for the comment: "// Add the list li background colors" in your doc... and place it under that.

chuck808 commented 9 years ago

Hi ddalli,

Sorry for the delayed response. I haven't had time to give it a go yet but thank you very much for your help.

angeenes commented 9 years ago

Thanks, works great except for the markerClusterStyles , for some reason, I can't make it work, anyways, just use 'markerCluster': true, and then it all works fine ! :+1:

bjorn2404 commented 8 years ago

I've added support for Marker Clusterer in v2.6.0 with the new markerCluster setting. When set, that setting value (needs to be an object) gets passed in to the third parameter of the MarkerClusterer constructor (options object). https://googlemaps.github.io/js-marker-clusterer/docs/reference.html