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

In 3D mode, returns a double that represents the pitch of the current map view.

VEMap.GetPitch();

Return Value

A double that represents the pitch, where 0 is level and -90 is straight down.

Remarks

The VEMap.GetAltitude Method, VEMap.GetHeading Method, and GetPitch method return values only when the map mode (VEMapMode Enumeration) is set to Mode3D and the current map view is completely loaded. To be sure that the map view is completely loaded, you can use the VEMap.onendpan Event.

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');

            // onLoadMap must be set before calling LoadMap
            map.onLoadMap = get3DSettings;
            map.LoadMap(null, null, null, null, VEMapMode.Mode3D);

            map.AttachEvent("onclick", get3DSettings);
            map.AttachEvent("onendpan", get3DSettings);
            map.AttachEvent("onendzoom", get3DSettings);
            map.AttachEvent("oninitmode", get3DSettings);
         }
         
         function get3DSettings()
         {
            var altitude = map.GetAltitude();
            var heading = map.GetHeading();
            var pitch = map.GetPitch();
            var info = "Altitude: " + altitude + "<br/>";
            info += "Heading: " + heading + "<br/>";
            info += "Pitch: " + pitch;
            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>