VEBirdseyeScene.GetBoundingRectangle 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 an unencrypted and rounded off bounding rectangle for the VEBirdseyeScene object.

VEBirdseyeScene.GetBoundingRectangle();

Return Value

A VELatLongRectangle Class object containing the bounding rectangle.

Remarks

The bounding rectangle's values can be up to two miles off the original latitude and longitude. The bounding rectangle is the same size or larger than the original bounding rectangle. The bounding rectangle is for the entire scene, not just for the map view. The center of the bounding rectangle may not be the center of the scene. In some scenes, the center of the bounding rectangle might not be within the scene.

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;

         function GetMap()
         {
            map = new VEMap('myMap');
         
            map.LoadMap(new VELatLong(47.62165, -122.3492), 18);

            // Let me know when a birdseye scene is available
            map.AttachEvent("onobliqueenter", OnObliqueEnterHandler);
         }

         function OnObliqueEnterHandler()
         {
            if (map.IsBirdseyeAvailable())
            {
               map.SetMapStyle(VEMapStyle.Birdseye);

               // So we don't repeatedly reset map style
               map.DetachEvent("onobliqueenter", OnObliqueEnterHandler);
            }
         }
            
         function GetInfo()
         {
            var info = "";

            if (map.IsBirdseyeAvailable())
            {
               var be = map.GetBirdseyeScene();

               // Get pixel info about center of the map
               var pixel = be.LatLongToPixel(map.GetCenter(), map.GetZoomLevel());

               info += "Map center pixel coordinates are : (" + pixel.x + ", " + pixel.y + ")\n\n";

               var rect = be.GetBoundingRectangle();

               // Display bounding rectangle property values to user
               info += "Top-left corner: (" + 
                       rect.TopLeftLatLong.Latitude + 
                       ", " +
                       rect.TopLeftLatLong.Longitude +
                       ")\n";
               
               if(map.GetMapMode() == VEMapMode.Mode3D)
               {
                  info += "Top-right corner: (" + 
                          rect.TopRightLatLong.Latitude + 
                          ", " +
                          rect.TopRightLatLong.Longitude +
                          ")\n";
               }

               info += "Bottom-right corner: (" + 
                       rect.BottomRightLatLong.Latitude + 
                       ", " +
                       rect.BottomRightLatLong.Longitude +
                       ")\n";
                       
               if(map.GetMapMode() == VEMapMode.Mode3D)
               {
                  info += "Bottom-left corner: (" + 
                          rect.BottomLeftLatLong.Latitude + 
                          ", " +
                          rect.BottomLeftLatLong.Longitude +
                          ")\n";
               }

               alert(info);
            }
            else
            {
              alert("Sorry, birdseye is not available");
            }
         }
      </script>
   </head>
   <body onload="GetMap();">
      <div id='myMap' style="position:relative; width:600px; height:400px;"></div>
      <input id="getinfo" type="button" value="Show info about current scene" name="getinfo" 
         onclick="GetInfo();">
   </body>
</html>