问题
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