VEMap.GetAltitude メソッド

3D モードにおいて、ジオイド上の高度 (メートル単位) を表す double を返します。

構文

VEMap.GetAltitude();

戻り値

ジオイド上の高度 (メートル単位) を表す double を返します。

解説

高度は、地表面ではなくジオイドからの距離がメートル単位で表されます。

GetAltitude メソッド、VEMap.GetHeading メソッド、および VEMap.GetPitch メソッドは、マップ モード (VEMapMode 列挙体) が Mode3D に設定され、現在のマップ ビューが完全に読み込まれている場合にのみ値を返します。マップ ビューが完全に読み込まれているかどうかを確認するには、VEMap.onendpan イベントを使用します。

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://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="http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.1"></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.LoadMap();

map.SetMapMode(VEMapMode.Mode3D);
map.SetMapStyle(VEMapStyle.Aerial);
map.SetMapView(initView);
map.AttachEvent("onendzoom", GetAltitude);
         } 
         
function GetAltitude()
         {
var dblAlt = map.GetAltitude();
showAltitude.innerHTML = "<p>高度:" + dblAlt + " メートル</p>";
         }
         
function SetAltitude()
         {
map.SetAltitude(txtAlt.value);
         }
</script>
</head>
<body onload="GetMap();" style="font-family:MS PGothic">
<div id='myMap' style="position:relative; width:400px; height:400px;"></div>
<INPUT id="setaltitude" type="button" value="高度の設定" name="setaltitude" 
onclick="SetAltitude();"/>
<INPUT id="txtAlt" type="text" value="20000" name="txtAlt" />
<div id="showAltitude"></div>
</body>
</html>