Google maps 混合使用谷歌地图api v2和v3可能吗?

Google maps 混合使用谷歌地图api v2和v3可能吗?,google-maps,google-maps-api-3,google-maps-api-2,Google Maps,Google Maps Api 3,Google Maps Api 2,链接一个。看看代码: function initialize() { if (GBrowserIsCompatible()) { // Create and Center a Map var map = new GMap2(document.getElementById("map_canvas")); map.setCenter(new GLatLng(37.4419, -122.1419), 13); map.addControl(new GLargeMa

链接一个。看看代码:

function initialize() {
  if (GBrowserIsCompatible()) {

    // Create and Center a Map
    var map = new GMap2(document.getElementById("map_canvas"));
    map.setCenter(new GLatLng(37.4419, -122.1419), 13);
    map.addControl(new GLargeMapControl());
    map.addControl(new GMapTypeControl());

    // bind a search control to the map, suppress result list
    map.addControl(new google.maps.LocalSearch(), new GControlPosition(G_ANCHOR_BOTTOM_RIGHT, new GSize(10,20)));
  }
}
GSearch.setOnLoadCallback(initialize);
地图显然在v2中,但代码
new google.maps.LocalSearch()
是v3

这怎么可能?


也许它不是真正的API v3。我认为它可能会被弃用,但事实并非如此:在这个API中,对象是
google.search.localSearch
,而在这里它是
google.maps.localSearch
。。。我完全糊涂了。

那个例子只使用v2,根本不使用v3。v2 API可以选择公开
google.maps
下的所有内容(例如
google.maps.GeoXml
)——不过大多数人只是使用“G”命名

google.search.LocalSearch
(允许您查询谷歌本地搜索结果)和
google.maps.LocalSearch
(这是一个v2控件)之间也有区别。因为这两个API都不推荐使用,所以我会避免使用它们