google earth の getGroundAltitude をするとマイナスの値が帰ってくる件

ブラウザの方のgoogle earthで、ge.getGlobe().getGroundAltitude(lat, lon); とかやると、その緯度経度の地面の高さを取ってきてくれるんですけど、ちょっと試しに使ってみたら-798とかマイナスの値が帰ってくる。

で、解決方法はこれで、


getGroundAltitude over the ocean: sea floor or zero? -
Google Earth Plug-in |
Google Groups

要は、その緯度経度辺りのオブジェクトを読み込めということ。サンプルでも getGroundAltitude の値が一定の値を超えていなかった場合は、もう一度トライするという仕組みになってました。

function move(lat, lon) {
  var altitude = ge.getGlobe().getGroundAltitude(lat, lon);
  var camera = ge.getView().copyAsCamera(this.ge.ALTITUDE_RELATIVE_TO_GROUND);
  camera.setLatitude(lat);
  camera.setLongitude(lon);
  ge.getView().setAbstractView(camera);

  setTimeout(function() {
    if (altitude < xxx) {
      move(lat, lon);
    }
  }, 500);
}

こんな感じです。