标签+集群 - 谷歌地图(gmap3)

问题描述:

美好的一天。标签+集群 - 谷歌地图(gmap3)

我使用Google Maps的Gmap3 jQuery插件,并试图让标记与标记一起工作,但是每次添加标记时,标记(来自示例标记的过滤)都不起作用。 下面是从网站我在(使用Wordpress)工作我的代码:

$(function(){ 
    var data = [], 
     tmp = {}, 
     r, k, 
     pubtypes = [], 
     $dpts = $("#pubtype"), 
    icons = {"Certifikované provozovny":'provozovna',"Tankovny":'tankovna'}; 

    $.each(villes, function(i, ville){ 
     data.push({ 
      lat: ville.lat, 
      lng: ville.lng, 
      tag: ville.pubtype, 
      data: ville, 

options: { icon: new google.maps.MarkerImage('<?php bloginfo('template_directory'); ?>/gfx/pin-'+icons[ville.pubtype]+'.png') 
          } 
     }); 
     tmp[ ville.pubtype ] = true; 
    }); 

    for(r in tmp){ 
     pubtypes.push(r); 
    } 
    pubtypes = pubtypes.sort(); 

    for(k in pubtypes){ 
     $dpts.append('<input id="chk'+k+'" type="checkbox" checked><label for="chk'+k+'">'+pubtypes[k]+'</label><br />'); 
    } 

    $('input', $dpts).change(function(){ 
     var pubtype = $('label[for='+$(this).attr('id')+']', $dpts).html(), 
      checked = $(this).is(':checked'), 
      map = $('#test1').gmap3('get'), 
      markers; 

     markers = $('#test1').gmap3({ 
      action:'get', 
      name:'marker', 
      all: true, 
      tag:pubtype 
     }); 

     $.each(markers, function(i, marker){ 
      marker.setMap(checked ? map : null); 
     }); 

    }); 

    $('#test1').gmap3(
    { action:'init', 
     options:{ 
      center:[49.743341,15.336227], 
      zoom: 7, 
      streetViewControl: false, 
      mapTypeId: google.maps.MapTypeId.ROADMAP 
     } 
     },{ 
     action:'addMarkers', 
     radius:100, 
     markers: data, 
     maxZoom:13, 
     radius:40, 
     clusters:{ 
      // This style will be used for clusters with more than 0 markers 
      0: { 
       content: '<div class="cluster cluster-1">CLUSTER_COUNT</div>', 
       width: 53, 
       height: 52 
      }, 
      // This style will be used for clusters with more than 20 markers 
      20: { 
       content: '<div class="cluster cluster-2">CLUSTER_COUNT</div>', 
       width: 56, 
       height: 55 
      }, 
      // This style will be used for clusters with more than 50 markers 
      50: { 
       content: '<div class="cluster cluster-3">CLUSTER_COUNT</div>', 
       width: 66, 
       height: 65 
      } 
     }, 
     marker: { 

      options: { 
       //icon: new google.maps.MarkerImage('<?php bloginfo('template_directory'); ?>/gfx/beer.png') 
       //icon: new google.maps.MarkerImage('<?php bloginfo('template_directory'); ?>/gfx/'+marker+'.png') 
      },    
      events:{ 
       click: function(marker, event, data) { infoWindowOpen($this, marker, data) } 
      } 
     } 
    }); 

}); 

感谢您为每个小块的帮助和建议。

我遇到同样的问题。我不认为这是可能的标签和集群相结合(现在..) 我发现这对gmap3论坛:

http://gmap3.net/forum/viewtopic.php?id=71“不,你不能与聚类功能生成单个标记玩”