虚拟地球(Bing)Pin“移动”当缩放级别改变时
创建了一个虚拟地球 (Bing) 地图,以在特定点显示一个简单的图钉。现在一切正常 - 图钉显示,标题和描述在悬停时弹出。
地图最初完全放大到图钉中,但奇怪的问题是,当我缩小时,它在地图上稍微移动得更低。因此,如果我从指向多伦多某处的图钉开始,如果我缩小得足够大,图钉最终会指向安大略湖的中部!如果我平移地图,图钉会正确地停留在正确的位置。当我重新放大时,它会稍微向上移动,直到回到原来的正确位置!
我已经四处寻找解决方案一段时间了,但我根本无法理解。请帮忙!!
多谢!
import with javascript: http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.2
$(window).ready(function(){
GetMap();
});
map = new VEMap('birdEye');
map.SetCredentials("hash key from Bing website");
map.LoadMap(new VELatLong(43.640144 ,-79.392593), 1 , VEMapStyle.BirdseyeHybrid, false, VEMapMode.Mode2D, true, null);
var pin = new VEShape(VEShapeType.Pushpin, new VELatLong(43.640144 ,-79.392593));
pin.SetTitle("Goes to Title of the Pushpin");
pin.SetDescription("Goes as Description.");
map.AddShape(pin);
Created a Virtual Earth (Bing) map to show a simple pin at a particular point. Everything works right now - the pin shows up, the title and description pop up on hover.
The map is initially fully zoomed into the pin, but the STRANGE problem is that when I zoom out it moves slightly lower on the map. So if I started with the pin pointing somewhere in Toronto, if I zoom out enough the pin ends up i the middle of Lake Ontario! If I pan the map, the pin correctly stays in its proper location. When I zoom back in, it moves slightly up until it's back to its original correct position!
I've looked around for a solution for a while, but I can't understand it at all. Please help!!
Thanks a lot!
import with javascript: http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.2
$(window).ready(function(){
GetMap();
});
map = new VEMap('birdEye');
map.SetCredentials("hash key from Bing website");
map.LoadMap(new VELatLong(43.640144 ,-79.392593), 1 , VEMapStyle.BirdseyeHybrid, false, VEMapMode.Mode2D, true, null);
var pin = new VEShape(VEShapeType.Pushpin, new VELatLong(43.640144 ,-79.392593));
pin.SetTitle("Goes to Title of the Pushpin");
pin.SetDescription("Goes as Description.");
map.AddShape(pin);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我也有同样的问题。但是,我的代码看起来正在使用 Microsoft.Maps AJAX 方法。
我在 bing 地图上设置了事件位置,该地图是通过查询 facebook 的 api 中的 user_events 和friend_events 获得的。一个事件连同纬度和经度返回给我。
我使用这些坐标为单个引脚和集群引脚放置自定义样式的引脚。
当我缩小时,药水会移动,并且会提供有关事件位置的不切实际的表示。
答案:
我发现您必须为图钉设置“锚点”属性。
这是我发现效果很好的方法。
资源 :
使用锚点图钉选项的示例
注意*查看“加载模块集群”
您需要单击“加载模块部分”中的第一个链接
http://www.bingmapsportal.com/isdk/ajaxv7#LoadingDynamicModule2
文档图钉选项“锚”
http://msdn.microsoft.com/en-us/library/gg427629。 ASPX
I had the same problem. However, my code looks to be using the Microsoft.Maps AJAX methods.
I set locations of events on a bing map that I got from querying facebook's api for user_events and friend_events. An event was returned to me with the latitude and longitude.
I used those coordinates to place a custom styled pin for single pins and clustered pins.
When I zoomed out the potions would move and an un-realistic representation was provided about the location of the event.
ANSWER:
I found out you have to set the "anchor" property for the pushpin.
Here is what I found that works well.
Resources :
Example of using anchor pushpinoption
Note* Look at the "Load Module Clustering"
You will need to click the first link in the "Load modules section"
http://www.bingmapsportal.com/isdk/ajaxv7#LoadingDynamicModule2
documentat ion of pushpin option "anchor"
http://msdn.microsoft.com/en-us/library/gg427629.aspx
不完全是您正在寻找的答案,但是,我遇到了确切的问题,发现“移动”发生在我已声明比例变换的引脚上。
缩小时,比例因子将应用于图钉并且位置会发生移动。我会看一下您的 Pushpin 类,看看转换是否存在。
Not exactly the/an answer you're looking for but, I have the exact problem and found that the "move" happens on my pins that I have declared a scale transform for.
When you zoom out, the scale factor is applied to the pin and the location is shifted. I would take a look at your Pushpin class to see if the transform exists.
尝试将 PositionOrigin 添加到图钉,将其设置为“Center”或其他。
Try adding PositionOrigin to the pushpin, set it to "Center" or whatever.