我正在尝试使用 JS 和 VB.NET 中的 Google Maps API v3 作为地图的服务器端数据数组制作地图。我的地图在没有集群的情况下成功加载,但是当我尝试在地图上应用集群时,我的标记变得不可见并且不显示在地图上。
这是我制作地图和集群的代码
<script src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
var script = '<script type="text/javascript" src="http://google-maps-utility-library-v3.googlecode.com/svn/trunk/markerclusterer/src/markerclusterer';
if (document.location.search.indexOf('compiled') !== -1) {
script += '_compiled';
}
script += '.js"><' + '/script>';
document.write(script);
</script>
<script type="text/javascript">
google.load('maps', '3', {
other_params: 'sensor=false'
});
google.setOnLoadCallback(initialize);
var map;
var markers = [];
var markerClusterer = null;
function initialize() {
var GPS = <%=GPS %>
var map_center = new google.maps.LatLng(31.2330555556,72.3330555556);
var myOptions = {
zoom: 6,
scaleControl:true,
pancontrol: true,
streetViewControl: true,
center: map_center,
mapTypeControl: true,
mapTypeControlOptions: {
style: google.maps.MapTypeControlStyle.DROPDOWN_MENU
},
mapTypeId: google.maps.MapTypeId.HYBRID
}
map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
var infowindow = new google.maps.InfoWindow();
var image = 'ico/gn.png';
for(var i=0; i<GPS.length; i++)
{
var marker=new google.maps.Marker({
position:GPS[i].GPS,
draggable:true,
icon:image,
Info: '<table frame=box><tr><td align="Left"><font face="Arial" size=2 color=#336699>Shop Name:</td><td align="Left"><font face="Arial" size=2>'+ GPS[i].SHOP + '</font></td></tr><tr>'+
'<td align="Left"><font face="Arial" size=2 color=#336699>Owner:</td><td align="Left"><font face="Arial" size=2>'+ GPS[i].OWNER + '</font></td></tr>'+
'<td align="Left"><font face="Arial" size=2 color=#336699>Mobile:</td><td align="Left"><font face="Arial" size=2>'+ GPS[i].MOBILE + '</font></td></tr>'+
'<tr><td align="Left"><font face="Arial" size=2 color=#336699>Distributer:</td><td align="Left"><font face="Arial" size=2>'+ GPS[i].DIST + '</font></td></tr><tr>'+
'<tr><td align="Left"><font face="Arial" size=2 color=#336699>Region:</td><td align="Left"><font face="Arial" size=2>'+ GPS[i].REGION + '</font></td></tr>'+
'<tr><td align="Left"></td><td align="Left"><font face="Arial" size=2 color=#336699><a target=_blank href=http://221.120.216.52/elp/sfpl.php?ccode=01&®no='+ GPS[i].REGNO +'>View</a></td></tr>'+
'</table>',
title:GPS[i].SHOP + '(' +GPS[i].DIST + ' )'
});
markers.push(marker);
google.maps.event.addListener(markers[i], 'click', function() {
infowindow.setContent(this.Info);
infowindow.open(map,this);
});
}
markerClusterer = new MarkerClusterer(map,markers,
{
maxZoom:5
});
}
</script>
任何人?请帮助我摆脱这个问题,并告诉我我的代码中究竟缺少什么。