OpenLayers. Layer.WMS

Instances of OpenLayers.Layer.WMS are used to display data from OGC Web Mapping Services.  Create a new WMS layer with the OpenLayers.Layer.WMS constructor.

Inherits from

Summary
OpenLayers. Layer.WMSInstances of OpenLayers.Layer.WMS are used to display data from OGC Web Mapping Services.
Constants
DEFAULT_PARAMS{Object} Hashtable of default parameter key/value pairs
Properties
reprojectDeprecated.
isBaseLayer{Boolean} Default is true for WMS layer
encodeBBOX{Boolean} Should the BBOX commas be encoded? 
noMagic{Boolean} If true, the image format will not be automagicaly switched from image/jpeg to image/png or image/gif when using TRANSPARENT=TRUE.
yx{Object} Keys in this object are EPSG codes for which the axis order is to be reversed (yx instead of xy, LatLon instead of LonLat), with true as value.
Constructor
OpenLayers. Layer.WMSCreate a new WMS layer object
Functions
destroyDestroy this layer
cloneCreate a clone of this layer
reverseAxisOrderReturns true if the axis order is reversed for the WMS version and projection of the layer.
getURLReturn a GetMap query string for this layer
addTileaddTile creates a tile, initializes it, and adds it to the layer div.
mergeNewParamsCatch changeParams and uppercase the new params to be merged in before calling changeParams on the super class.
getFullRequestStringCombine the layer’s url with its params and these newParams.

Constants

DEFAULT_PARAMS

{Object} Hashtable of default parameter key/value pairs

Properties

reproject

Deprecated.  See http://trac.openlayers.org/wiki/SphericalMercator for information on the replacement for this functionality.  {Boolean} Try to reproject this layer if its coordinate reference system is different than that of the base layer.  Default is true.  Set this in the layer options.  Should be set to false in most cases.

isBaseLayer

{Boolean} Default is true for WMS layer

encodeBBOX

{Boolean} Should the BBOX commas be encoded?  The WMS spec says ‘no’, but some services want it that way.  Default false.

noMagic

{Boolean} If true, the image format will not be automagicaly switched from image/jpeg to image/png or image/gif when using TRANSPARENT=TRUE.  Also isBaseLayer will not changed by the constructor.  Default false.

yx

{Object} Keys in this object are EPSG codes for which the axis order is to be reversed (yx instead of xy, LatLon instead of LonLat), with true as value.  This is only relevant for WMS versions >= 1.3.0.

Constructor

OpenLayers. Layer.WMS

Create a new WMS layer object

Example

var wms = new OpenLayers.Layer.WMS("NASA Global Mosaic",
                                   "http://wms.jpl.nasa.gov/wms.cgi",
                                   {layers: "modis,global_mosaic"});

Parameters

name{String} A name for the layer
url{String} Base url for the WMS (e.g.  http://wms.jpl.nasa.gov/wms.cgi)
params{Object} An object with key/value pairs representing the GetMap query string parameters and parameter values.
options{Ojbect} Hashtable of extra options to tag onto the layer

Functions

destroy

destroy: function()

Destroy this layer

clone

clone: function (obj)

Create a clone of this layer

Returns

{OpenLayers.Layer.WMS} An exact clone of this layer

reverseAxisOrder

reverseAxisOrder: function()

Returns true if the axis order is reversed for the WMS version and projection of the layer.

Returns

{Boolean} true if the axis order is reversed, false otherwise.

getURL

getURL: function (bounds)

Return a GetMap query string for this layer

Parameters

bounds{OpenLayers.Bounds} A bounds representing the bbox for the request.

Returns

{String} A string with the layer’s url and parameters and also the passed-in bounds and appropriate tile size specified as parameters.

addTile

addTile:function(bounds,
position)

addTile creates a tile, initializes it, and adds it to the layer div.

Parameters

bounds{OpenLayers.Bounds}
position{OpenLayers.Pixel}

Returns

{OpenLayers.Tile.Image} The added OpenLayers.Tile.Image

mergeNewParams

mergeNewParams:function(newParams)

Catch changeParams and uppercase the new params to be merged in before calling changeParams on the super class.

Once params have been changed, the tiles will be reloaded with the new parameters.

Parameters

newParams{Object} Hashtable of new params to use

getFullRequestString

getFullRequestString:function(newParams,
altUrl)

Combine the layer’s url with its params and these newParams.

Add the SRS parameter from projection -- this is probably more eloquently done via a setProjection() method, but this works for now and always.

Parameters

newParams{Object}
altUrl{String} Use this as the url instead of the layer’s url

Returns

{String}

destroy: function()
Destroy this layer
clone: function (obj)
Create a clone of this layer
reverseAxisOrder: function()
Returns true if the axis order is reversed for the WMS version and projection of the layer.
getURL: function (bounds)
Return a GetMap query string for this layer
addTile:function(bounds,
position)
addTile creates a tile, initializes it, and adds it to the layer div.
mergeNewParams:function(newParams)
Catch changeParams and uppercase the new params to be merged in before calling changeParams on the super class.
getFullRequestString:function(newParams,
altUrl)
Combine the layer’s url with its params and these newParams.
Create a new WMS layer object
Base class for layers that use a lattice of tiles.
Instances of this class represent bounding boxes.
This class represents a screen coordinate, in x and y coordinates
Instances of OpenLayers.Tile.Image are used to manage the image tiles used by various layers.
Close