Search code examples
virtual-earth

VirtualEarth: determine min/max visible latitude/longitude


Is there an easy way to determine the maximum and minimum visible latitude and longitude in a VirtualEarth map? Given that it's not a flat surface (VE uses Mercator projection it looks like) I can see the math getting fairly complicated, I figured somebody may know of a snippet to accomplish this.


Solution

  • Found it! VEMap.GetMapView() returns the bounding rectangle, even works for 3D mode as well (where the boundary is not even a rectangle).

    var view = map.GetMapView();
    
    latMin = view.BottomRightLatLong.Latitude;
    lonMin = view.TopLeftLatLong.Longitude;
    latMax = view.TopLeftLatLong.Latitude;
    lonMax = view.BottomRightLatLong.Longitude;