【问题标题】:"ghost" clusters when customizing markercluster icon using angular-leaflet-directive使用 angular-leaflet-directive 自定义 markercluster 图标时的“ghost”集群
【发布时间】:2014-12-16 08:43:45
【问题描述】:

我正在尝试使用以下代码自定义 angular-leaflet markerclusters:

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

我有一个包含 7 个标记的测试样本,定义如下:

                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
                    },
                    ...
                ]

如果我使用 visible: false 隐藏叠加层或不使用叠加层,我会得到正确数量的标记,但永远不会调用 customMarkerCluster。

使用 visible:true,我得到 3 个 4 个标记的集群(12 个标记而不是 7 个)

当我使用叠加层时,如何防止 markercluster 生成错误的簇?

【问题讨论】:

    标签: angularjs angularjs-directive leaflet markerclusterer angular-leaflet-directive


    【解决方案1】:

    显然,我的选项组搞乱了标记集群的生成,我删除了组并且一切正常(+ 清理了我的示例)

                        {
                            "_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
    
                        }
    

    【讨论】:

      猜你喜欢
      • 2023-03-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-07-15
      • 1970-01-01
      • 2023-03-19
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多