Maps Bing地图上的叠加图钉-如何显示这两个图钉的元数据或在特定缩放时移动图钉
我正在从Access365数据库生成一个HTML/Javascript文件,该数据库在Bing地图上绘制PIN。每一个管脚都有与其所固定位置相关联的元数据,可通过单击管脚查看该元数据。但是,可以有完全相同位置(lat和long)的管脚,并且只有顶部管脚的元数据可用 我如何显示组合的元数据,或者当用户将鼠标移到管脚上时,让管脚稍微分开一点?有人知道怎么做吗?我环顾四周看了MS文档,找不到任何帮助 另外,还有一个集群层。如果需要移除以解决问题,那没关系,但如果它可以保留,那会更好Maps Bing地图上的叠加图钉-如何显示这两个图钉的元数据或在特定缩放时移动图钉,maps,bing-maps,bing,pushpin,Maps,Bing Maps,Bing,Pushpin,我正在从Access365数据库生成一个HTML/Javascript文件,该数据库在Bing地图上绘制PIN。每一个管脚都有与其所固定位置相关联的元数据,可通过单击管脚查看该元数据。但是,可以有完全相同位置(lat和long)的管脚,并且只有顶部管脚的元数据可用 我如何显示组合的元数据,或者当用户将鼠标移到管脚上时,让管脚稍微分开一点?有人知道怎么做吗?我环顾四周看了MS文档,找不到任何帮助 另外,还有一个集群层。如果需要移除以解决问题,那没关系,但如果它可以保留,那会更好 <!DOCT
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta charset="utf-8" />
<!-- Reference to the Bing Maps SDK -->
<script type='text/javascript'
src='http://www.bing.com/api/maps/mapcontrol?callback=GetMap&key=[zzz]'
async defer></script>
<script type='text/javascript'>
function GetMap()
{
var map = new Microsoft.Maps.Map('#myMap', {center: new Microsoft.Maps.Location(53.50632, -7.2714), zoom:8});
var ourBlue = 'rgb(108, 162, 212)';
//Create an infobox at the center of the map but don't show it.
infobox = new Microsoft.Maps.Infobox(map.getCenter(), {
visible: false
});
//Assign the infobox to a map instance.
infobox.setMap(map);
var theLocations = [3];
var thePins = [3];
theLocations[0] = new Microsoft.Maps.Location(53.41, -7.1);
theLocations[1] = new Microsoft.Maps.Location(53.42, -7.1);
theLocations[2] = new Microsoft.Maps.Location(53.43, -7.1);
for (var i = 0; i < theLocations.length; i++){
var pin = new Microsoft.Maps.Pushpin(theLocations[i]);
pin.metadata = {
title: 'Pin ' + i, description: 'Description for pin' + i
};
Microsoft.Maps.Events.addHandler(pin, 'click', pushpinClicked);
Microsoft.Maps.Events.addHandler(pin, 'mouseover', splitOverlap);
Microsoft.Maps.Events.addHandler(pin, 'mouseout', function (e) {
e.target.setOptions({ color:'purple' });
});
thePins[i] = pin; //add pin to array of pins
}
Microsoft.Maps.loadModule("Microsoft.Maps.Clustering", function(){
clusterLayer = new Microsoft.Maps.ClusterLayer(thePins);
map.layers.insert(clusterLayer);
});
}
function splitOverlap(e) {
var ourBlue = 'rgb(108, 162, 212)';
e.target.setOptions({color:ourBlue});
}
}
function pushpinClicked(e) {
//Make sure the infobox has metadata to display.
if (e.target.metadata) {
//Set the infobox options with the metadata of the pushpin.
infobox.setOptions({
location: e.target.getLocation(),
title: e.target.metadata.title,
description: e.target.metadata.description,
visible: true
});
}
}
</script>
<script type='text/javascript' src='http://www.bing.com/api/maps/mapcontrol?callback=GetMap&key=Arvr3LDJsmNB-2OGHl_egpbP9RbwsYKGKrktnPBC06G38T9q3CzsfmwK6GNoW7R_' async defer></script>
</head>
<body>
<div id="myMap" style="position:relative;width:600px;height:400px;"></div>
</body>
</html>
函数GetMap()
{
var map=new Microsoft.Maps.map('#myMap',{center:new Microsoft.Maps.Location(53.50632,-7.2714),zoom:8});
var ourBlue=‘rgb(108162212)’;
//在地图的中心创建一个信息框,但不要显示它。
infobox=新的Microsoft.Maps.infobox(map.getCenter(){
可见:假
});
//将信息框指定给地图实例。
infobox.setMap(map);
变量位置=[3];
var thePins=[3];
位置[0]=新的Microsoft.Maps.Location(53.41,-7.1);
位置[1]=新的Microsoft.Maps.Location(53.42,-7.1);
位置[2]=新的Microsoft.Maps.Location(53.43,-7.1);
对于(变量i=0;i
当您有集群并且希望查看集群中项目的单个元日期时,有两种常见方法:
嗨@rbrundritt。谢谢你的回复和链接。不幸的是,在我看到这一点之前,我必须完成这项工作,所以我在相同经度和纬度的后续引脚上添加了一个轻推,只是将它们沿着街道移动了几码。但是,如果客户要求我再次访问此站点,我肯定会遵循您的蜘蛛集群想法,它看起来非常理想!谢谢