v3.js

Summary
v3.js
Constants
OpenLayers.Layer.Google.v3Mixin providing functionality specific to the Google Maps API v3.
DEFAULTS{Object} It is not recommended to change the properties set here.
Functions
loadMapObjectLoad the GMap and register appropriate event listeners.
repositionMapElementsWaits until powered by and terms of use elements are available and then moves them so they are clickable.
setGMapVisibilityDisplay the GMap container and associated elements.
getMapContainer{DOMElement} the GMap container’s div

Constants

OpenLayers.Layer.Google.v3

Mixin providing functionality specific to the Google Maps API v3.

To use this layer, you must include the GMaps v3 API in your html.

Because OpenLayers needs to control mouse events, it isolates the GMaps mapObject (the DOM elements provided by Google) using the EventPane.  However, because the Terms of Use require some of those elements, such as the links to Google’s terms, to be clickable, these elements have to be moved up to OpenLayers’ container div.  There is however no easy way to identify these, and the logic (see the repositionMapElements function in the source) may need to be changed if Google changes them.  These elements are not part of the published API and can be changed at any time, so a given OpenLayers release can only guarantee support for the ‘frozen’ Google release at the time of the OpenLayers release.  See https://developers.google.com/maps/documentation/javascript/basics#Versioning for Google’s current release cycle.

For this reason, it’s recommended that production code specifically loads the current frozen version, for example:

<script src="http://maps.google.com/maps/api/js?v=3.7&amp;sensor=false"></script>

but that development code should use the latest ‘nightly’ version, so that any problems can be dealt with as soon as they arise, and before they affect the production, ‘frozen’, code.

Note, however, that frozen versions are retired as part of Google’s release cycle, and once this happens, you will get the next version, in the example above, 3.8 once 3.7 is retired.

This version supports 3.7.

Note that this layer configures the google.maps.map object with the “disableDefaultUI” option set to true.  Using UI controls that the Google Maps API provides is not supported by the OpenLayers API.

DEFAULTS

{Object} It is not recommended to change the properties set here.  Note that Google.v3 layers only work when sphericalMercator is set to true.

{
    sphericalMercator: true,
    projection: "EPSG:900913"
}

Functions

loadMapObject

loadMapObject:function()

Load the GMap and register appropriate event listeners.  If we can’t load GMap2, then display a warning message.

repositionMapElements

repositionMapElements: function()

Waits until powered by and terms of use elements are available and then moves them so they are clickable.

setGMapVisibility

setGMapVisibility: function(visible)

Display the GMap container and associated elements.

Parameters

visible{Boolean} Display the GMap elements.

getMapContainer

getMapContainer: function()

Returns

{DOMElement} the GMap container’s div

loadMapObject:function()
Load the GMap and register appropriate event listeners.
repositionMapElements: function()
Waits until powered by and terms of use elements are available and then moves them so they are clickable.
setGMapVisibility: function(visible)
Display the GMap container and associated elements.
getMapContainer: function()
{DOMElement} the GMap container’s div
Close