[英]MarkClusterer map issue: find nearest latitude/longitude
我在Google Map API v3中使用了Markclusterer扩展程序,遇到了某些麻烦,该地图可以完美显示并且集群也可以工作,但是我的问题是某些地址共享相同的经度和纬度,因此将地址分组并显示地址数为一组,但我无法进一步放大该组。 我尝试增加缩放比例,但没有帮助。 任何理想或解决方案将不胜感激,谢谢。
var map;
var markers = new Array();
var locations = new Array();
var infowindow = new google.maps.InfoWindow();
function initialize() {
var center = new google.maps.LatLng(<%= GetCenterLatLng() %>);
// var center = new google.maps.LatLng(52.6500, 1.2800);
var infowindow = new google.maps.InfoWindow();
map = new google.maps.Map(document.getElementById('map'), {
zoom: 13,
center: center,
mapTypeId: google.maps.MapTypeId.ROADMAP
});
initialiseMarkers();
var mcOptions = { gridSize: 50, maxZoom: 15 };
var markerCluster = new MarkerClusterer(map, markers, mcOptions);
}
function addMarker(marker, content) {
google.maps.event.addListener(marker, 'click', function () {
infowindow.setContent(content); // this is the trick: html attribute on markerOptions :), I used a array here
infowindow.open(map, this);
});
}
<script type="text/javascript">
var script = '<script type="text/javascript" src="../Scripts/markerclusterer';
if (document.location.search.indexOf('compiled') !== -1) {
script += '_compiled';
}
script += '.js"><' + '/script>';
document.write(script);
</script>
如有任何疑问,请与我联系,谢谢
经过几天的动摇,也许是一个不眠之夜。 解决方案是将包含与一个标记相同的经度和纬度的地址归为一组,然后单击它在弹出窗口(infoWindow)上显示同一附近内的所有地址。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.