简体   繁体   中英

Marker Clusterer Google Maps

Hy,

I don't know why the marker clusterer don't show my markers grouped , like here : http://media.svennerberg.com/2009/01/screenshot_clusterereffect.jpg

My Code is like this:

    <!DOCTYPE html>
<html>
<head>
<script type="text/javascript"
    src="http://maps.google.com/maps/api/js?sensor=false">
</script>
<script type="text/javascript">

 function initialize() {
        var center = new google.maps.LatLng(48.136, 11.586);

        var myOptions = {
          zoom: 3,
          center: center,
          mapTypeId: google.maps.MapTypeId.ROADMAP
        };
        var map = new google.maps.Map(document.getElementById("map_canvas"),myOptions); 

        var points =  []; 
        for (var i = 0; i < 600; i++) {

                var point = new google.maps.Marker({
                    position: new google.maps.LatLng(48.135 + Math.random(), 11.664 + Math.random()),
                    map: map,
                    title:"This is where I work"
                }); 
                points.push(point);

        }

        var cluster = new MarkerClusterer(map, points);
    }

</script>
</head>
<body onload="initialize()">
  <div id="map_canvas" style="width:1000px; height:1000px"></div>
</body>
</html>

but it don't work. Who can tell my why it don't work? Thx

问题已解决:)我的html文件未加载正确的json,这就是为什么它无法解决的原因

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM