VEMap.GetAltitude 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 altitude (in meters) above the geoid.


A double that represents the altitude (in meters) above the geoid.

Altitude is represented as meters above the geoid, not above the ground level.

The GetAltitude method, VEMap.GetHeading Method, and VEMap.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.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

      <script type="text/javascript" src=""></script>

      <script type="text/javascript">
         var map = null;
         var alt = null;
         var center = new VELatLong(33.338550,-118.424636);
         var initView = new VEMapViewSpecification(center, 1, 50000, -90, 0);
         function GetMap()
            map = new VEMap('myMap');

            map.AttachEvent("onendzoom", GetAltitude);
         function GetAltitude()
            var dblAlt = map.GetAltitude();
            showAltitude.innerHTML = "<p>Altitude: " + dblAlt + " meters.</p>";
         function SetAltitude()
   <body onload="GetMap();" style="font-family:Arial">
      <div id='myMap' style="position:relative; width:400px; height:400px;"></div>
      <INPUT id="setaltitude" type="button" value="Set Altitude" name="setaltitude" 
      <INPUT id="txtAlt" type="text" value="20000" name="txtAlt" />
      <div id="showAltitude"></div>