[OpenLayers-Users] AW: map.RemoveLayer() does not work

Leich Tobias Tobias.Leich at adckrone.com
Mon Sep 7 01:44:34 EDT 2009


 
Hi, please try: 

var layers = map.getLayersByName('choice_features');
	    		
for(var layerIndex = 0; layerIndex < layers.length; layerIndex++)
{
	map.removeLayer(layers[layerIndex]);
}

Mit freundlichen Grüßen/Best regards 

Tobias Leich 
Softwareentwicklung & Systemadministration
Service Management Center

ADC KRONE Services 
tobias.leich at adckrone.com
Mobil: +49 (0) 151 / 580 43 596
Tel.: +49 (0) 3328 / 4590 512
Fax.: +49 (0) 3328 / 4590 55 512 
 
Learn more about ADC KRONE at www.adckrone.com 
Rheinstraße 10B / 14513 Teltow / Germany 
ADC Services GmbH, Sitz Teltow, Amtsgericht Potsdam - HRB 19612 P
Geschäftsführer: Fritz Lohr
Ust-Id-Nr. DE 137227829

-----Ursprüngliche Nachricht-----
Von: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org] Im Auftrag von sunny74
Gesendet: Montag, 7. September 2009 07:14
An: users at openlayers.org
Betreff: [OpenLayers-Users] map.RemoveLayer() does not work


Hi,

I am trying to remove a layer using the RemoveLayer(layer,
        setNewBaseLayer) function.
The code is:

 map.removeLayer(choice_features, false);
It is only able to remove the layer "choice_features" the very first time it
is created at PageLoad.
But when the same layer is created the second time it is unable to remove it
and throws javascript exception

htmlfile: Invalid argument.

So how to get it to remove the layer every time it is created.
Awaiting solution.

Thanks for your replies. 
-- 
View this message in context: http://n2.nabble.com/map-RemoveLayer-does-not-work-tp3595538p3595538.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
_______________________________________________
Users mailing list
Users at openlayers.org
http://openlayers.org/mailman/listinfo/users



More information about the Users mailing list