OpenLayers.Layer.Google - OpenLayers

# OpenLayers. Layer. Google

#### Inherits from

- OpenLayers.Layer.SphericalMercator
- OpenLayers.Layer.EventPane
- OpenLayers.Layer.FixedZoomLevels

Summary

OpenLayers. Layer. Google |
Constants |
MIN_ZOOM_LEVEL | {Integer} 0
MAX_ZOOM_LEVEL | {Integer} 19
RESOLUTIONS | {Array(Float)} Hardcode these resolutions so that they are more closely tied with the standard wms projection
Properties |
type | {GMapType}
sphericalMercator | {Boolean} Should the map act as a mercator-projected map?
dragObject | {GDraggableObject} Since 2.93, Google has exposed the ability to get the maps GDraggableObject.
Constructor |
OpenLayers. Layer. Google |
Functions |
loadMapObject | Load the GMap and register appropriate event listeners.
setMap | Overridden from EventPane because if a map type has been specified, we need to attach a listener for the first moveend -- this is how we will know that the map has been centered.
setMapType | The map has been centered, and a map type was specified, so we set the map type on the gmap object, then unregister the listener so that we dont keep doing this every time the map moves.
onMapResize |
display | Hide or show the layer
getOLBoundsFromMapObjectBounds |
getMapObjectBoundsFromOLBounds |
addContainerPxFunction | Hack-on function because GMAPS does not give it to us
getWarningHTML | {String} String with information on why layer is broken, how to get it working.
setMapObjectCenter | Set the mapObject to the specified center and zoom
dragPanMapObject |
getMapObjectCenter | {Object} The mapObject’s current center in Map Object format
getMapObjectZoom | {Integer} The mapObject’s current zoom, in Map Object format
getMapObjectLonLatFromMapObjectPixel |
getMapObjectPixelFromMapObjectLonLat |
getMapObjectZoomFromMapObjectBounds |
getLongitudeFromMapObjectLonLat |
getLatitudeFromMapObjectLonLat |
getMapObjectLonLatFromLonLat |
getXFromMapObjectPixel |
getYFromMapObjectPixel |
getMapObjectPixelFromXY |

### Constants

### MIN_ZOOM_LEVEL

{Integer} 0

### MAX_ZOOM_LEVEL

{Integer} 19

### RESOLUTIONS

{Array(Float)} Hardcode these resolutions so that they are more closely tied with the standard wms projection

### Properties

### type

{GMapType}

### sphericalMercator

{Boolean} Should the map act as a mercator-projected map? This will cause all interactions with the map to be in the actual map projection, which allows support for vector drawing, overlaying other maps, etc.

### dragObject

{GDraggableObject} Since 2.93, Google has exposed the ability to get the maps GDraggableObject. We can now use this for smooth panning

### Constructor

### OpenLayers. Layer. Google

#### Parameters

name | {String} A name for the layer.
options | {Object} An optional object whose properties will be set on the layer.

### Functions

### loadMapObject

> loadMapObject:function()

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

### setMap

> setMap: function( | map | )

Overridden from EventPane because if a map type has been specified, we need to attach a listener for the first moveend -- this is how we will know that the map has been centered. Only once the map has been centered is it safe to change the gmap object’s map type.

#### Parameters

map | {OpenLayers.Map}

### setMapType

> setMapType: function()

The map has been centered, and a map type was specified, so we set the map type on the gmap object, then unregister the listener so that we dont keep doing this every time the map moves.

### onMapResize

> onMapResize: function()

#### Parameters

evt | {Event}

### display

> display: function( | display | )

Hide or show the layer

#### Parameters

display | {Boolean}

### getOLBoundsFromMapObjectBounds

> getOLBoundsFromMapObjectBounds: function( | moBounds | )

#### Parameters

moBounds | {Object}

#### Returns

{OpenLayers.Bounds} An OpenLayers.Bounds, translated from the passed-in MapObject Bounds. Returns null if null value is passed in.

### getMapObjectBoundsFromOLBounds

> getMapObjectBoundsFromOLBounds: function( | olBounds | )

#### Parameters

olBounds | {OpenLayers.Bounds}

#### Returns

{Object} A MapObject Bounds, translated from olBounds Returns null if null value is passed in

### addContainerPxFunction

> addContainerPxFunction: function()

Hack-on function because GMAPS does not give it to us

#### Parameters

gLatLng | {GLatLng}

#### Returns

{GPoint} A GPoint specifying gLatLng translated into “Container” coords

### getWarningHTML

> getWarningHTML:function()

#### Returns

{String} String with information on why layer is broken, how to get it working.

### setMapObjectCenter

> setMapObjectCenter: function( | center,
> | zoom | )

Set the mapObject to the specified center and zoom

#### Parameters

center | {Object} MapObject LonLat format
zoom | {int} MapObject zoom format

### dragPanMapObject

> dragPanMapObject: function( | dX,
> | dY | )

#### Parameters

dX | {Integer}
dY | {Integer}

### getMapObjectCenter

> getMapObjectCenter: function()

#### Returns

{Object} The mapObject’s current center in Map Object format

### getMapObjectZoom

> getMapObjectZoom: function()

#### Returns

{Integer} The mapObject’s current zoom, in Map Object format

### getMapObjectLonLatFromMapObjectPixel

> getMapObjectLonLatFromMapObjectPixel: function( | moPixel | )

#### Parameters

moPixel | {Object} MapObject Pixel format

#### Returns

{Object} MapObject LonLat translated from MapObject Pixel

### getMapObjectPixelFromMapObjectLonLat

> getMapObjectPixelFromMapObjectLonLat: function( | moLonLat | )

#### Parameters

moLonLat | {Object} MapObject LonLat format

#### Returns

{Object} MapObject Pixel transtlated from MapObject LonLat

### getMapObjectZoomFromMapObjectBounds

> getMapObjectZoomFromMapObjectBounds: function( | moBounds | )

#### Parameters

moBounds | {Object} MapObject Bounds format

#### Returns

{Object} MapObject Zoom for specified MapObject Bounds

### getLongitudeFromMapObjectLonLat

> getLongitudeFromMapObjectLonLat: function( | moLonLat | )

#### Parameters

moLonLat | {Object} MapObject LonLat format

#### Returns

{Float} Longitude of the given MapObject LonLat

### getLatitudeFromMapObjectLonLat

> getLatitudeFromMapObjectLonLat: function( | moLonLat | )

#### Parameters

moLonLat | {Object} MapObject LonLat format

#### Returns

{Float} Latitude of the given MapObject LonLat

### getMapObjectLonLatFromLonLat

> getMapObjectLonLatFromLonLat: function( | lon,
> | lat | )

#### Parameters

lon | {Float}
lat | {Float}

#### Returns

{Object} MapObject LonLat built from lon and lat params

### getXFromMapObjectPixel

> getXFromMapObjectPixel: function( | moPixel | )

#### Parameters

moPixel | {Object} MapObject Pixel format

#### Returns

{Integer} X value of the MapObject Pixel

### getYFromMapObjectPixel

> getYFromMapObjectPixel: function( | moPixel | )

#### Parameters

moPixel | {Object} MapObject Pixel format

#### Returns

{Integer} Y value of the MapObject Pixel

### getMapObjectPixelFromXY

> getMapObjectPixelFromXY: function( | x,
> | y | )

#### Parameters

x | {Integer}
y | {Integer}

#### Returns

{Object} MapObject Pixel from x and y parameters

> loadMapObject:function()

Load the GMap and register appropriate event listeners.

> setMap: function( | map | )

Overridden from EventPane because if a map type has been specified, we need to attach a listener for the first moveend -- this is how we will know that the map has been centered.

> setMapType: function()

The map has been centered, and a map type was specified, so we set the map type on the gmap object, then unregister the listener so that we dont keep doing this every time the map moves.

> onMapResize: function()

> display: function( | display | )

Hide or show the layer

> getOLBoundsFromMapObjectBounds: function( | moBounds | )

> getMapObjectBoundsFromOLBounds: function( | olBounds | )

> addContainerPxFunction: function()

Hack-on function because GMAPS does not give it to us

> getWarningHTML:function()

{String} String with information on why layer is broken, how to get it working.

> setMapObjectCenter: function( | center,
> | zoom | )

Set the mapObject to the specified center and zoom

> dragPanMapObject: function( | dX,
> | dY | )

> getMapObjectCenter: function()

{Object} The mapObject’s current center in Map Object format

> getMapObjectZoom: function()

{Integer} The mapObject’s current zoom, in Map Object format

> getMapObjectLonLatFromMapObjectPixel: function( | moPixel | )

> getMapObjectPixelFromMapObjectLonLat: function( | moLonLat | )

> getMapObjectZoomFromMapObjectBounds: function( | moBounds | )

> getLongitudeFromMapObjectLonLat: function( | moLonLat | )

> getLatitudeFromMapObjectLonLat: function( | moLonLat | )

> getMapObjectLonLatFromLonLat: function( | lon,
> | lat | )

> getXFromMapObjectPixel: function( | moPixel | )

> getYFromMapObjectPixel: function( | moPixel | )

> getMapObjectPixelFromXY: function( | x,
> | y | )

A mixin for layers that wraps up the pieces neccesary to have a coordinate conversion for working with commercial APIs which use a spherical mercator projection.
Base class for 3rd party layers.
Some Layers will already have established zoom levels (like google or ve).
Instances of OpenLayers.Map are interactive maps embedded in a web page.
Instances of this class represent bounding boxes.
Close