Share via


VEMap.GetBirdseyeScene 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.

If the map view is already set to bird's eye, returns the current VEBirdseyeScene Class object.

VEMap.GetBirdseyeScene();

Return Value

Returns null if the map mode is set to 3D (VEMap.GetMapMode Method returns 2). Otherwise returns a VEBirdseyeScene Class object that represents the current bird's eye image.

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>