Hi,
byClass means by CLASS_NAME
A good source for further reading is always the OpenLayers code:
/**
* APIMethod: getLayersByClass
* Get a list of layers of a given class (CLASS_NAME).
*
* Parameter:
* match - {String | Object} A layer class name. The match can also be
a
* regular expression literal or object. In addition, it can be any
* object with a method named test. For reqular expressions or
other,
* if type.test(layer.CLASS_NAME) evaluates to true, the layer will
* be included in the list of layers returned. If no layers are
* found, an empty array is returned.
*
* Returns:
* {Array(<OpenLayers.Layer>)} A list of layers matching the given
class.
* An empty array is returned if no matches are found.
*/
CLASS_NAME: "OpenLayers.Layer.WMS"
map.getLayersByClass("OpenLayers.Layer.WMS").length;
Regards,
Arnd
-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von P Kishor
Gesendet: Donnerstag, 23. September 2010 22:56
An: users
Betreff: [OpenLayers-Users] removing a group of layers
I want to remove a set of layers from the map, while keeping other layers. I
see there is a map.getLayersByClass() method which returns an array of
layers of a certain class. I am guessing, I can do something like so
var layers = map.getLayersByClass('foo'); for (var i=0; i < layers.length;
i++) {
map.removeLayer(i);
}
Is the above assumption correct? And, that said, how and where do I attach a
class to a layer? I don't see any option to set a WMS layer to class = 'foo'
when adding it. What am I missing?
--
Puneet Kishor http://www.punkish.org
Carbon Model http://carbonmodel.org
Charter Member, Open Source Geospatial Foundation http://www.osgeo.org
Science Commons Fellow, http://sciencecommons.org/about/whoweare/kishor
Nelson Institute, UW-Madison http://www.nelson.wisc.edu
-----------------------------------------------------------------------
Assertions are politics; backing up assertions with evidence is science
=======================================================================
_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users
_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users