我的MarkerClusterer有问题:我没有收集群集。每个标记仍由他自己! FireBug无法帮助。 http://gmaps-utility-library-dev.googlecode.com/svn/tags/markerclusterer/1.0/示例和文档无法帮助..
我希望,有人可以帮助我!
<!DOCTYPE html>
<html>
<head>
</script>
<style type="text/css">
html { height: 100% }
body { height: 100%; margin: 0; padding: 0 }
#map-canvas { height: 100% }
</style>
<script type="text/javascript" src="http://google-maps-utility-library-v3.googlecode.com/svn/trunk/markerclusterer/src/data.json"></script>
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?v=3&sensor=false"></script>
<script type="text/javascript">
var script = '<script type="text/javascript" src="../src/markerclusterer';
if (document.location.search.indexOf('compiled') !== -1) {
script += '_compiled';
}
script += '.js"><' + '/script>';
document.write(script);
</script>
<script type='text/javascript'>
function initialize() {
var mapOptions = {
center: new google.maps.LatLng(0,0),
zoom: 1,
mapTypeId: google.maps.MapTypeId.ROADMAP};
var map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);
var markers = [];
var mcOptions = {gridSize: 50, maxZoom: 15};
var myLatlng_1 = new google.maps.LatLng(48.047111,11.4471008);
var marker_1 = new google.maps.Marker({ position: myLatlng_1,map: map, title:'Twitter - click to see content'});
var contentstring_1 = 'asdf';
var infowindow_1 = new google.maps.InfoWindow({content: contentstring_1});
google.maps.event.addListener(marker_1, 'click', function(){ infowindow_1.open(map,marker_1);});
markers.push(marker_1, false);
(...)
var myLatlng_5 = new google.maps.LatLng(48.001163813597,11.28131322089);
var marker_5 = new google.maps.Marker({ position: myLatlng_5,map: map, title:'Twitter - click to see content'});
var contentstring_5 = 'asdf';
var infowindow_5 = new google.maps.InfoWindow({content: contentstring_5});
google.maps.event.addListener(marker_5, 'click', function(){ infowindow_5.open(map,marker_5);});
markers.push(marker_5, false);
var markerCluster = new MarkerClusterer(map, markers, mcOptions);
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
</head>
<body>
<div id="map-canvas" style="border:1; border-color: black; position:absolute; width:800px; height:450px;"></div>
</body>
</html>
答案 0 :(得分:0)
完成。 “markers.push(MARKER_1);”没有“假”