[OpenLayers-Commits] r12144 - trunk/openlayers/lib/OpenLayers/Layer

commits-20090109 at openlayers.org commits-20090109 at openlayers.org
Thu Jun 30 10:51:26 EDT 2011


Author: ahocevar
Date: 2011-06-30 07:51:25 -0700 (Thu, 30 Jun 2011)
New Revision: 12144

Modified:
   trunk/openlayers/lib/OpenLayers/Layer/WMS.js
Log:
better documentation for Layer.WMS

Modified: trunk/openlayers/lib/OpenLayers/Layer/WMS.js
===================================================================
--- trunk/openlayers/lib/OpenLayers/Layer/WMS.js	2011-06-30 07:45:55 UTC (rev 12143)
+++ trunk/openlayers/lib/OpenLayers/Layer/WMS.js	2011-06-30 14:51:25 UTC (rev 12144)
@@ -76,20 +76,47 @@
      * Constructor: OpenLayers.Layer.WMS
      * Create a new WMS layer object
      *
-     * Example:
+     * Examples:
+     *
+     * This code creates a simple WMS layer using the image/jpeg format:
      * (code)
      * var wms = new OpenLayers.Layer.WMS("NASA Global Mosaic",
      *                                    "http://wms.jpl.nasa.gov/wms.cgi", 
      *                                    {layers: "modis,global_mosaic"});
      * (end)
+     * 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.
      *
+     * This code creates a transparent WMS layer with additional options:
+     * (code)
+     * var wms = new OpenLayers.Layer.WMS("NASA Global Mosaic",
+     *                                    "http://wms.jpl.nasa.gov/wms.cgi", 
+     *                                    {
+     *                                        layers: "modis,global_mosaic",
+     *                                        transparent: true
+     *                                    }, {
+     *                                        opacity: 0.5,
+     *                                        singleTile: true
+     *                                    });
+     * (end)
+     * 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.
+     *
      * 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
+     * options - {Ojbect} Hashtable of extra options to tag onto the layer.
+     *     These options include all properties listed above, plus the ones
+     *     inherited from superclasses.
      */
     initialize: function(name, url, params, options) {
         var newArguments = [];



More information about the Commits mailing list