OpenLayers.Layer.SphericalMercator

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.  Using this layer as a base layer, additional layers can be used as overlays if they are in the same projection.

A layer is given properties of this object by setting the sphericalMercator property to true.

More projection information

Proj4 Text

+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs

WKT

900913=PROJCS[“WGS84 / Simple Mercator”, GEOGCS[“WGS 84”, DATUM[“WGS_1984”, SPHEROID[“WGS_1984”, 6378137.0, 298.257223563]], PRIMEM[“Greenwich”, 0.0], UNIT[“degree”, 0.017453292519943295], AXIS[“Longitude”, EAST], AXIS[“Latitude”, NORTH]], PROJECTION[“Mercator_1SP_Google”], PARAMETER[“latitude_of_origin”, 0.0], PARAMETER[“central_meridian”, 0.0], PARAMETER[“scale_factor”, 1.0], PARAMETER[“false_easting”, 0.0], PARAMETER[“false_northing”, 0.0], UNIT[“m”, 1.0], AXIS[“x”, EAST], AXIS[“y”, NORTH], AUTHORITY[“EPSG”,”900913”]]

Summary
OpenLayers.Layer.SphericalMercatorA 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.
Functions
getExtentGet the map’s extent.
initMercatorParametersSet up the mercator parameters on the layer: resolutions, projection, units.
forwardMercatorGiven a lon,lat in EPSG:4326, return a point in Spherical Mercator.
inverseMercatorGiven a x,y in Spherical Mercator, return a point in EPSG:4326.
projectForwardGiven an object with x and y properties in EPSG:4326, modify the x,y properties on the object to be the Spherical Mercator projected coordinates.
projectInverseGiven an object with x and y properties in Spherical Mercator, modify the x,y properties on the object to be the unprojected coordinates.

Functions

getExtent

getExtent: function()

Get the map’s extent.

Returns

{OpenLayers.Bounds} The map extent.

initMercatorParameters

initMercatorParameters: function()

Set up the mercator parameters on the layer: resolutions, projection, units.

forwardMercator

forwardMercator: function(lon,
lat)

Given a lon,lat in EPSG:4326, return a point in Spherical Mercator.

Parameters

lon{float}
lat{float}

Returns

{OpenLayers.LonLat} The coordinates transformed to Mercator.

inverseMercator

inverseMercator: function(x,
y)

Given a x,y in Spherical Mercator, return a point in EPSG:4326.

Parameters

x{float} A map x in Spherical Mercator.
y{float} A map y in Spherical Mercator.

Returns

{OpenLayers.LonLat} The coordinates transformed to EPSG:4326.

projectForward

projectForward: function(point)

Given an object with x and y properties in EPSG:4326, modify the x,y properties on the object to be the Spherical Mercator projected coordinates.

Parameters

point{Object} An object with x and y properties.

Returns

{Object} The point, with the x and y properties transformed to spherical mercator.

projectInverse

projectInverse: function(point)

Given an object with x and y properties in Spherical Mercator, modify the x,y properties on the object to be the unprojected coordinates.

Parameters

point{Object} An object with x and y properties.

Returns

{Object} The point, with the x and y properties transformed from spherical mercator to unprojected coordinates..

getExtent: function()
Get the map’s extent.
initMercatorParameters: function()
Set up the mercator parameters on the layer: resolutions, projection, units.
forwardMercator: function(lon,
lat)
Given a lon,lat in EPSG:4326, return a point in Spherical Mercator.
inverseMercator: function(x,
y)
Given a x,y in Spherical Mercator, return a point in EPSG:4326.
projectForward: function(point)
Given an object with x and y properties in EPSG:4326, modify the x,y properties on the object to be the Spherical Mercator projected coordinates.
projectInverse: function(point)
Given an object with x and y properties in Spherical Mercator, modify the x,y properties on the object to be the unprojected coordinates.
Instances of this class represent bounding boxes.
This class represents a longitude and latitude pair
Close