Google maps 使用geoxml3类和ProjectedOverlay类将kml文件传递到Google Earth时出现问题

Google maps 使用geoxml3类和ProjectedOverlay类将kml文件传递到Google Earth时出现问题,google-maps,kml,google-earth-plugin,Google Maps,Kml,Google Earth Plugin,我试图构建一个显示城市的谷歌地球视图,但我坚持使用kml解析器geoxml3。我有一个javascript构建了一个谷歌地图,首先显示了我想要的位置。这个很好用。我从一个php脚本调用该函数,该脚本提供了一个地址和数据库中的kml文件引用。该函数构建地图,在一切正常运行时将标志“map_finished”设置为控制标志,并调用build google earth view函数 // Get maps and earth from google google.load( 'maps', '2.s'

我试图构建一个显示城市的谷歌地球视图,但我坚持使用kml解析器geoxml3。我有一个javascript构建了一个谷歌地图,首先显示了我想要的位置。这个很好用。我从一个php脚本调用该函数,该脚本提供了一个地址和数据库中的kml文件引用。该函数构建地图,在一切正常运行时将标志“map_finished”设置为控制标志,并调用build google earth view函数

// Get maps and earth from google
google.load( 'maps', '2.s', {'other_params': 'sensor=true'} );
google.load( 'earth', '1' );

//Google Earth Initializer
function initObjectEarth() {
  // Check if Google Earth plugin is installed   
  if( gm_loaded ) {
  this.ge_plugin_installed = google.earth.isInstalled();

  if( this.ge_plugin_installed ) {
    google.earth.createInstance( 'inmap', geSuccessCallback, geFailureCallback );
    ge_loaded = true;
  } else {
    alert( 'Your Browser has not yet installed the Google Earth plugin. 
            We recommend installing it to use all features!' );
    return false;
  }
 }
}

// Success handler
function geSuccessCallback( object ) {
  this.ge = object;
  this.ge.getWindow().setVisibility( true );
  this.kmlParser = new geoXML3.parser();
}

// Error handler
function geFailureCallback( object ) {
   alert( 'Error: ' + object );
}
geoxml解析器使用ProjectedOverlay类。这两个库都加载到文档头中。当解析器恢复时,它请求ProjectedOverlay实例。这个班抛出一个

Error: **google.maps is undefined**
以下语句的firebug中出现错误

ProjectedOverlay.prototype = new google.maps.OverlayView();
在我的脚本文件中,我声明了变量,包括

var gm //for google map
var ge //for google earth
gm设置在构建google地图的函数中

我想知道如何解决这个问题。我尝试了在web中找到的getProjection()方法,也尝试了

ProjectedOverlay.prototype = new google.maps.OverlayView().prototype;
没有成功。这个话题对我来说是全新的,我无法从OverlyView的文档和谷歌搜索中找到解决方法


我忘记了什么或做错了什么?

对geoXML3构造函数的调用是错误的,必须将google.maps对象作为参数传递(…因此出现“google.maps未定义”错误)

this.kmlParser = new geoXML3.parser({map: gm}); // gm for google map