Bing Maps vs Google Maps -> markers are in different places

拥有回忆 提交于 2019-12-11 06:22:33

问题


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.

see

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

vs

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


回答1:


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.

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



来源:https://stackoverflow.com/questions/7380248/bing-maps-vs-google-maps-markers-are-in-different-places

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!