显示群集,而不是单个引脚

时间:2013-01-28 13:54:05

标签: javascript google-maps google-maps-api-2

我有一个js代码,在那里我尝试创建一个集群,以便像下面这样的图像:enter image description here

但是,我想只提供群集,而不是在提供各个引脚的位置。我的代码如下:

<script type="text/javascript">    
function initialize()
{
    <?= $geoData ?>
    if (GBrowserIsCompatible()) {     
        var map = new GMap2(document.getElementById("map_canvas"));
        map.setCenter(new GLatLng(50, 0), 1);
        map.addControl(new GSmallMapControl());         
        // Create our "tiny" marker icon
        var icon = new GIcon(G_DEFAULT_ICON);       
        icon.image = "http://chart.apis.google.com/chart?cht=mm&chs=24x32&chco=FFFFFF,008CFF,000000&ext=.png";              
        var markers = [];
        for (var i = 0; i < <?= $total_records ?>; i++) {
          var latlng = new GLatLng(geo_data.records[i].lat, geo_data.records[i].lng);
          var marker = new GMarker(latlng, {icon: icon});
          markers.push(marker);
        }
    var zoom = 14;
            var size = 60;
    var markerCluster = new MarkerClusterer(map, markers,  {maxZoom: zoom, gridSize: size} );
   }
}
</script>

<script type="text/javascript">
 initialize();
</script>

为了摆脱各个群集,我应该将哪些内容更改为我的代码?

0 个答案:

没有答案