虚拟地球(Bing)引脚“移动"到缩放级别更改时 [英] Virtual Earth (Bing) Pin "moves" when zoom level changes

查看:66
本文介绍了虚拟地球(Bing)引脚“移动"到缩放级别更改时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

创建了虚拟地球(Bing)地图,以在特定点处显示简单的图钉.一切现在都可以正常进行-悬停时会显示图钉,标题和说明会弹出.

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.

最初,地图已完全放大到图钉中,但是STRANGE问题是,当我缩小地图时,地图上的位置会稍微降低.因此,如果我从大头针指向多伦多的某个地方开始,如果我缩小得足够大,大头针就会到达安大略湖中部!如果我平移地图,则图钉会正确地停留在其正确的位置.当我放大时,它会稍微向上移动,直到回到原来的正确位置!

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!!

非常感谢!

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);

推荐答案

我遇到了同样的问题.但是,我的代码似乎正在使用Microsoft.Maps AJAX方法. 我在bing地图上设置了事件的位置,该地图是通过查询facebook的api中的user_events和friend_events获得的.纬度和经度又回到了我的身边. 我使用这些坐标为单个图钉和群集图钉放置了自定义样式的图钉. 当我缩小时,药水会移动,并且提供了关于事件发生位置的不切实际的表示.

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.

我发现您必须设置锚点"图钉的属性.

I found out you have to set the "anchor" property for the pushpin.

这是我发现效果很好的结果.

Here is what I found that works well.

    var pushpinOption = {
      icon : 'images/cluster_custom.png',
      text : ''+ clusterInfo.dataIndices.length + '',
      textOffset:offset,
      anchor :  new Microsoft.Maps.Point(8, 8)
    };

资源: 使用锚图钉选项的示例 注意*请参阅加载模块群集"部分. 您需要点击加载模块部分"中的第一个链接, http://www.bingmapsportal.com/isdk/ajaxv7#LoadingDynamicModule2

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

文档 http://msdn.microsoft.com/en-us/library/gg427629. aspx

这篇关于虚拟地球(Bing)引脚“移动"到缩放级别更改时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆