How to get coordinates of corners of visible bing map?

做~自己de王妃 提交于 2020-01-24 13:20:07

问题


I'm using Bing Maps in a windows 8 app and I need to display pushpins at numerous locations.

Is there any way to get the GPS coordinates of the corners of the visible map?

Or alternatively a way to get the distance of the visible map? (e.g. 40km width, 60km height)

I need this in order to limit the number of pushpins I attach to the map to just being the ones on the visible part of the map.


回答1:


You can get this information directly from the Bounds property of the map instance, which returns a LocationRect defined by the Northwest and Southeast lat/lng locations shown in the current view. http://msdn.microsoft.com/en-us/library/hh846504.aspx




回答2:


Try using the TryPixelToLocation method.

Location locationOfPixel
if(MyMap.TryPixelToLocation(ThePointToLookUp, out locationOfPixel))
{
    //locationOfPixelshould contain the lat/long of the give point on the map.
}

Obviously, you will need to work out what the pixel locations of the top left, top right, bottom left and bottom right of your map control are and pass them in accordingly.



来源:https://stackoverflow.com/questions/12801943/how-to-get-coordinates-of-corners-of-visible-bing-map

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