"ghost" clusters when setting the markercluster icon with angular-leaflet-directive

I am trying to set up angular-leaflet markerclusters with the following code:

            overlays: {
                defaultOverlay: {
                    type: 'markercluster',
                    name: 'defaultOverlay',
                    visible: true,
                    layerOptions: {
                        showCoverageOnHover: true,
                        disableClusteringAtZoom: 15,
                        iconCreateFunction: customMarkerCluster
                    }
                }
            }

      

I have a 7 markers test pattern defined like this:

                markers: [
                    {
                        _id: "548f0ab268dc96e7587c0f8f",
                        layer:"defaultOverlay",
                        group: "testgroup1",
                        lat: 20.973368,
                        lng: 40.849463,
                        title: "IMPERIUM",
                        message: "215 Rockaway Parkway, Delshire, Ohio, 9191",
                        icon: $scope.icons.onlineNotifIcon,
                        status: 1
                    },
                    ...
                ]

      

If I hide the overlay with visible: false or don't use the overlay, I get the correct number of markers, but the customMarkerCluster never gets called.

With visible: true, I get 3 clusters of 4 markers (12 markers instead of 7)

How can I prevent markercluster from generating wrong clusters when I use overlay?

+3


source to share


1 answer


Apparently my option group was messing around with generating markercluster, I removed the group and everything works fine (+ cleaned up my example)



                    {
                        "_id": "548f0ab268dc96e7587c0f8f",
                        layer:"defaultOverlay",
                        lat: 28.239855,
                        lng: 14.752357,
                        title: "BITTOR",
                        message: "856 Furman Avenue, Comptche, Nebraska, 3995",
                        icon: $scope.icons.onlineIcon,
                        status: 0

                    }

      

+1


source







All Articles