[OpenLayers-Users] Antw: Re: remove all layers

Armin Wäspy armin.waespy at lubw.bwl.de
Thu Oct 18 07:36:33 EDT 2007


thanks a lot.
solved already by myself.

  var num = map.getNumLayers();
  for (var j=1; j<num; j++) {
   map.removeLayer( map.layers[1] );
  }  

>>> Christopher Schmidt <crschmidt at metacarta.com> 10/18/07 1:33 >>>
On Thu, Oct 18, 2007 at 10:51:50AM +0200, Armin W??spy wrote:
> hi list,
> is there a function which removes all displayed layers?

for (var i = map.layers.length - 1; i >= 0; i--) {
    map.removeLayer(map.layers[i]);
}    

Regards,
-- 
Christopher Schmidt
MetaCarta
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20071018/2bf0028f/attachment.html


More information about the Users mailing list