WMS Layer

Three args to constructor:

  • name -- used for display purposes
  • url -- URL of WMS Service
  • params -- {param:'name'} style list of parameters. Via this setting, you can also override existing settings, such as the format. All params are forced to uppercase. Default parameters are:
    DEFAULT_PARAMS: { SERVICE: "WMS",                                              
     VERSION: "1.1.1",                                            
     REQUEST: "GetMap",                                           
     STYLES: "",                                                  
     EXCEPTIONS: "application/vnd.ogc.se_inimage",                
     FORMAT: "image/jpeg"                                         

Typically, the one people want to edit most is the 'format' attribute.

Full params example:

  layer = new OpenLayers.Layer.WMS( "My WMS", 
		                    {layers: 'layer1,layer2,layer3','VERSION': "1.1.1",'units': 'meters'},
                                    {'maxExtent': new OpenLayers.Bounds(minx,miny,maxx,maxy),'maxResolution': "auto"} 

Multiple URLs example:

  var urlArray = ["",

  layer = new OpenLayers.Layer.WMS( "OpenLayers WMS", 
                                    {layers: 'basic'} );
Last modified 9 years ago Last modified on Nov 16, 2006 12:42:13 AM