必应地图与Google地图->标记在不同的地方 [英] Bing Maps vs Google Maps -> markers are in different places

查看:91
本文介绍了必应地图与Google地图->标记在不同的地方的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经制作了2张地图,一张是Bing Maps,另一张是Google Maps. 他们俩都从同一个数据文件中拉出一堆图钉. 但是,必应地图上的图钉看起来像是向北偏移太远,因此不在正确的位置.

I've made 2 maps, one with Bing Maps and one with Google Maps. They both pull from the same data file to put a bunch of pins on the map. However the pins on the Bing map look like they are offset too far north and so not in the right place.

请参见

http://upstairsweb.com/examples/bingmap.html

vs

http://upstairsweb.com/examples/googlemap.html

推荐答案

问题出在您使用的图标-

The problem is with the icon you're using - the PNG file at http://upstairsweb.com/examples/SmallRedMapPin.png itself is 16px x 18px is size, but the visible part of the pushpin is only drawn in the top left hand corner of the image. Bing Maps by default anchors a pushpin icon at the bottom centre of the map image, but because of the lop-sided transparent area that will make the icon appear to be too far up and to the left. I don't know how Google Maps anchors an icon when you haven't specified an explicit anchor point - perhaps it just hard codes an anchor that, by chance, happens to line up with your points.

无论哪种方式,我建议您首先修剪图像以摆脱外部多余的透明区域,和/或在PushpinOptions中显式设置锚点,相对于其描述的点放置图标: http://msdn.microsoft.com/en-us/library/gg427629. aspx

Either way, I'd suggest you first trim your image to get rid of the extraneous transparent area around the outside and/or explicitly set the anchor point in the PushpinOptions at which the icon should be placed relative to the point it describes: http://msdn.microsoft.com/en-us/library/gg427629.aspx

这篇关于必应地图与Google地图->标记在不同的地方的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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