VEMap.GetMapView Method

You are not viewing the latest version of the AJAX control. Bing Maps AJAX V7 is the recommended JavaScript control for Bing Maps. If you need this documentation, it is available in as a CHM or PDF download.

Returns the current map view object as a VELatLongRectangle Class object.

VEMap.GetMapView();

Return Value

A VELatLongRectangle Class object that represents the current map view.

Example

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
   <head>
      <title></title>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

      <script type="text/javascript" src="https://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.3"></script>

      <script type="text/javascript">
         var map = null;
         var clickEvent = null;
         
         function GetMap()
         {
            map = new VEMap('myMap');
            map.LoadMap();

            GetMapView();
            map.AttachEvent("onclick", GetMapView);
            map.AttachEvent("onendpan", GetMapView);
            map.AttachEvent("onendzoom", GetMapView);
            map.AttachEvent("oninitmode", GetMapView);
         } 
         
         function GetMapView()
         {
            view = map.GetMapView();
            topleft = view.TopLeftLatLong;
            bottomright = view.BottomRightLatLong;
            topright = view.TopRightLatLong;
            bottomleft = view.BottomLeftLatLong;
            info = "TopLeftLatLong: " + topleft + "<br/>";
            info += "BottomRightLatLong: " + bottomright + "<br/>";
            info += "TopRightLatLong: " + topright + " (3D mode only)<br/>";
            info += "BottomLeftLatLong: " + bottomleft + " (3D mode only)";
            infoDiv.innerHTML = info;
         }  
      </script>
   </head>
   <body onload="GetMap();" style="font-family:Arial">
      <div id='myMap' style="position:relative; width:400px; height:400px;"></div>
      <div id="infoDiv"></div>
   </body>
</html>