Instances of ALKMaps.Layer.WMS are used to display data from OGC Web Mapping Services. Create a new WMS layer with the ALKMaps.Layer.WMS constructor.
ALKMaps. | Instances of ALKMaps.Layer.WMS are used to display data from OGC Web Mapping Services. |
Constants | |
DEFAULT_PARAMS | {Object} Hashtable of default parameter key/value pairs |
Properties | |
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 | |
ALKMaps. | Create a new WMS layer object |
Functions | |
clone | Create a clone of this layer |
reverseAxisOrder | Returns true if the axis order is reversed for the WMS version and projection of the layer. |
getURL | Return a GetMap query string for this layer |
mergeNewParams | Catch changeParams and uppercase the new params to be merged in before calling changeParams on the super class. |
getFullRequestString | Combine the layer’s url with its params and these newParams. |
{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, and only if yx is not set in ALKMaps.Projection.defaults for the used projection.
Create a new WMS layer object
The code below creates a simple WMS layer using the image/jpeg format.
var wms = new ALKMaps.Layer.WMS("NASA Global Mosaic", "http://wms.jpl.nasa.gov/wms.cgi", {layers: "modis,global_mosaic"});
Note the 3rd argument (params). Properties added to this object will be added to the WMS GetMap requests used for this layer’s tiles. The only mandatory parameter is “layers”. Other common WMS params include “transparent”, “styles” and “format”. Note that the “srs” param will always be ignored. Instead, it will be derived from the baseLayer’s or map’s projection.
The code below creates a transparent WMS layer with additional options.
var wms = new ALKMaps.Layer.WMS("NASA Global Mosaic", "http://wms.jpl.nasa.gov/wms.cgi", { layers: "modis,global_mosaic", transparent: true }, { opacity: 0.5, singleTile: true });
Note that by default, a WMS layer is configured as baseLayer. Setting the “transparent” param to true will apply some magic (see noMagic). The default image format changes from image/jpeg to image/png, and the layer is not configured as baseLayer.
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 | {Object} Hashtable of extra options to tag onto the layer. These options include all properties listed above, plus the ones inherited from superclasses. |
clone: function ( obj )
Create a clone of this layer
{ALKMaps.Layer.WMS} An exact clone of this layer
getURL: function ( bounds )
Return a GetMap query string for this layer
bounds | {ALKMaps.Bounds} A bounds representing the bbox for the request. |
{String} A string with the layer’s url and parameters and also the passed-in bounds and appropriate tile size specified as parameters.
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.
newParams | {Object} |
altUrl | {String} Use this as the url instead of the layer’s url |
{String}
Create a clone of this layer
clone: function ( obj )
Returns true if the axis order is reversed for the WMS version and projection of the layer.
reverseAxisOrder: function()
Return a GetMap query string for this layer
getURL: function ( bounds )
Catch changeParams and uppercase the new params to be merged in before calling changeParams on the super class.
mergeNewParams:function( newParams )
Combine the layer’s url with its params and these newParams.
getFullRequestString:function( newParams, altUrl )