[OpenLayers-Users] map.RemoveLayer() does not work
sunny74
sb.ray at hotmail.com
Mon Sep 7 07:34:21 EDT 2009
Hi,
I can see that it is deleted and a new GML file created every time bec' it
contents are different when the selection has changed.
If it is a caching issue of openlayers or the webserver then how to tackle
them?
Pls tell me in details.
Thanks for your reply.
Leich Tobias wrote:
>
>
> the GML-file is on the webserver, right?
>
> do you see that it reloads this file from the webserver?
>
> otherwise it could be a caching issue of openlayers or your webserver...
>
>
> Mit freundlichen Grüßen/Best regards
>
> Tobias Leich
> Softwareentwicklung & Systemadministration
> Service Management Center
>
> -----Ursprüngliche Nachricht-----
> Von: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org] Im
> Auftrag von sunny74
> Gesendet: Montag, 7. September 2009 11:13
> An: users at openlayers.org
> Betreff: Re: [OpenLayers-Users] map.RemoveLayer() does not work
>
>
> Hi Leich,
>
> Thanks for your reply.
> It worked.
>
> However I am having one problem.
> I am removing one layer 'choice_features' using your code and then adding
> one by the same name using
> the following code:
>
> map.addLayer(new OpenLayers.Layer.GML("choice_features",
> "XML1/FeatureGML.xml"));
>
> This layer is being added from the file FeatureGML.xml in the folder XML1.
> The GML file is created at run time and with every change in selection its
> contents also changes.
> But the selected feature on the map remains the same after the first
> selection.
> Only the first time does it show the feature correctly.After that it shows
> the first one irrespective of the feature that is selected.
>
> What wrong am I doing & how to set it right?
>
> Thanks again.
>
> Leich Tobias wrote:
>>
>>
>> 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
>> _______________________________________________
>> Users mailing list
>> Users at openlayers.org
>> http://openlayers.org/mailman/listinfo/users
>>
>>
>
> --
> View this message in context:
> http://n2.nabble.com/map-RemoveLayer-does-not-work-tp3595538p3596265.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
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>
>
--
View this message in context: http://n2.nabble.com/map-RemoveLayer-does-not-work-tp3595538p3596786.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
More information about the Users
mailing list