在相同位置处理Google maps / Markerclusterer多个标记

时间:2017-06-06 12:33:26

标签: reactjs google-maps-markers markerclusterer markerspiderfier

我在React-redux项目中使用markerclusterer为所有公司绘制标记。我有3家公司拥有相同的地址。当我放大地图时,我可以看到数字3(标记簇),当进一步放大时,我只能看到1个标记(对于所有3个公司)。我需要显示一个标记(来自markerClusterer的具有相同地址的过滤器公司),当单击标记时,打开对话框以显示公司详细信息。最初加载地图时,会渲染标记(代码如下:)

      companies.map((company) => {
      this.marker = new google.maps.Marker({
      map: map,
      position: {lat: parseFloat(company.latitude),
                 lng: parseFloat(company.longitude)},
      icon: {url:'/src/images/blue_marker.png',
             size: new google.maps.Size(30, 30)},
      title: company.name + ' ' + company.vacancy.vacancy                  
      }); 
      options = {
        imagePath: '/src/images/m',
        maxZoom: 15,
        zoomOnClick: false
       };
       var markerCluster = new MarkerClusterer(map, markers, options);
       markerCluster.setMaxZoom(15);

0 个答案:

没有答案