OpenLayers.Projection

Class for coordinate transforms between coordinate systems.  Depends on the proj4js library.  If proj4js is not available, then this is just an empty stub.

Summary
OpenLayers.ProjectionClass for coordinate transforms between coordinate systems.
Constructor
OpenLayers.ProjectionThis class offers several methods for interacting with a wrapped pro4js projection object.
Functions
getCodeGet the string SRS code.
getUnitsGet the units string for the projection -- returns null if proj4js is not available.
addTransformSet a custom transform method between two projections.
transformTransform a point coordinate from one projection to another.

Constructor

OpenLayers.Projection

This class offers several methods for interacting with a wrapped pro4js projection object.

Parameters

projCode{String} A string identifying the Well Known Identifier for the projection.
options{Object} An optional object to set additional properties on the layer.

Returns

{OpenLayers.Projection} A projection object.

Functions

getCode

getCode: function()

Get the string SRS code.

Returns

{String} The SRS code.

getUnits

getUnits: function()

Get the units string for the projection -- returns null if proj4js is not available.

Returns

{String} The units abbreviation.

addTransform

OpenLayers.Projection.addTransform = function(from,
to,
method)

Set a custom transform method between two projections.  Use this method in cases where the proj4js lib is not available or where custom projections need to be handled.

Parameters

from{String} The code for the source projection
to{String} the code for the destination projection
method{Function} A function that takes a point as an argument and transforms that point from the source to the destination projection in place.  The original point should be modified.

transform

OpenLayers.Projection.transform = function(point,
source,
dest)

Transform a point coordinate from one projection to another.  Note that the input point is transformed in place.

Parameters

point{{OpenLayers.Geometry.Point> | Object} An object with x and y properties representing coordinates in those dimensions.
sourceProj{OpenLayers.Projection} Source map coordinate system
destProj{OpenLayers.Projection} Destination map coordinate system

Returns

point{object} A transformed coordinate.  The original point is modified.
getCode: function()
Get the string SRS code.
getUnits: function()
Get the units string for the projection -- returns null if proj4js is not available.
OpenLayers.Projection.addTransform = function(from,
to,
method)
Set a custom transform method between two projections.
OpenLayers.Projection.transform = function(point,
source,
dest)
Transform a point coordinate from one projection to another.
This class offers several methods for interacting with a wrapped pro4js projection object.
Close