【问题标题】:how fetch kml google earth api如何获取 kml 谷歌地球 api
【发布时间】:2015-07-14 15:33:40
【问题描述】:

我的 fetch kml 不起作用。这是我的代码:

function initCallback(object) {
  ge = object;
  ge.getWindow().setVisibility(true);
  function finished(object) {
    if (!object) {
      setTimeout(function() {
        alert('Bad or null KML.');
      }, 0);
      return;
    }
    ge.getFeatures().appendChild(object);
  }       

  var url = 'http://localhost/ta/bangun.aula.kml';
  google.earth.fetchKml(ge, url, finished);

  document.getElementById('installed-plugin-version').innerHTML = ge.getPluginVersion().toString();
}

【问题讨论】:

  • 描述“不起作用”。你看到了什么?你期待什么?

标签: kml fetch google-earth-plugin


【解决方案1】:

浏览器中的 js 不会直接解析 KML 文件。 Google 需要访问您的 KML 文件。 因此,您需要将 KML 文件放在 Google 可以访问的地方(在线托管)。 由于您的 KML 文件位于 localhost 上,因此 Google 无法访问它。

【讨论】:

    猜你喜欢
    • 2011-02-12
    • 2012-01-30
    • 1970-01-01
    • 1970-01-01
    • 2012-11-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多