分组标记映射
问题描述:
一个人怎么会去这个网站上找到为实现相同类型的标记分组? http://clevertrail.com/分组标记映射
这是不是由谷歌地图API交付?如果不是,那么如何创建这种类型的分组?
任何建议的解决方案是非常感谢!
答
您可以使用该标记集群:http://code.google.com/p/google-maps-utility-library-v3/wiki/Libraries。它在JS中进行分组,但效率不高。
答
一些调查后,他们似乎使用第三方插件/扩展程序来处理标记分组..这页上找到:http://code.google.com/p/google-maps-utility-library-v3/wiki/Libraries
答
你可以试试这个代码与各自的位置和值.. 你需要包括标记集群JS给你code..get从这里markerclustrer.js
<script>
var markerCluster = [];
var all_markers = [];
var infowindows = [];
var map;
function initialize(){
var mapProp = {
center:center,
zoom:5,
mapTypeId:google.maps.MapTypeId.ROADMAP
};
map=new google.maps.Map(document.getElementById("googleMap")
,mapProp);
addmarker(lat,long); //creating the marker....; function call can be looped
markerCluster = new MarkerClusterer(map, all_markers); //setting the markers' array as a cluster on google maps
}
function addmarker(lat,lng)
{
var mycenter = new google.maps.LatLng(lat,lng);
var marker = new google.maps.Marker({
position:mycenter,
});
all_markers.push(marker); //making an array of markers
}
</script>