Skip to content

Leaflet.markercluster integration #117

Answered by neillsanders
neillsanders asked this question in Q&A
Discussion options

You must be logged in to vote

After much toil I'm pleased to say that I have finally got this working using the method outlined by Ben in his FAQ "How can I add another Leaflet Plugin" and the following javascript. Hope it comes in handy and thank you once again Ben for your great plugin.

(function () {
    function main() {
        if (!window.WPLeafletMapPlugin) { console.log('no plugin found!'); return; }
        var geojsons = window.WPLeafletMapPlugin.geojsons;
        for (var i = 0, len = geojsons.length; i < len; i++) {
            var geojson = geojsons[i];
            geojson.addEventListener('ready', function (e) {
                var cluster = L.markerClusterGroup();
                cluster.addLayer(e.sour…

Replies: 3 comments 5 replies

Comment options

You must be logged in to vote
2 replies
@neillsanders
Comment options

@bozdoz
Comment options

Comment options

You must be logged in to vote
2 replies
@neillsanders
Comment options

@neillsanders
Comment options

Comment options

You must be logged in to vote
1 reply
@bozdoz
Comment options

Answer selected by neillsanders
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants