当同一经度和纬度上有多个标记时

时间:2019-06-12 08:53:50

标签: markerclusterer

这是我用来调用集群的代码。除非在同一位置有多个标记,否则它将起作用

 var markers = features.map(function(location, i) {
                        return new google.maps.Marker({
                            position: features[i].position,
                            icon: icon,
                            map: map,
                            title: features[i].title,
                            label: features[i].title,
                            url: features[i].url
                        });

                    });

                    for (index = 0; index < markers.length; ++index) {                          
                        google.maps.event.addListener(markers[index], 'click', function() {
                            window.location.href = this.url;
                        });
                    }

                    var markerCluster = new MarkerClusterer(map, markers,
                    {imagePath: '/wp-content/themes/spikes/icon/m'});

0 个答案:

没有答案