One question linked an interesting example of mixing API v2 and v3!. Look at the code:
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);
The map is apparently in v2 but the code new google.maps.LocalSearch() is v3!
How is this possible?
Maybe it’s not really API v3. I thought it could be deprecated Local Search API that worked within API v2, but it is not: in this API the object is google.search.localSearch while here it is google.maps.localsearch … I’m totaly confused.
That example only uses v2, not v3 at all. The v2 API does optionally expose everything under
google.maps(for examplegoogle.maps.GeoXml) – most people just use the ‘G’ naming though.There’s also a difference between
google.search.LocalSearch(which lets you query Google for local search results) andgoogle.maps.LocalSearch(which is a v2 control). Since both APIs are deprecated, I’d avoid both!