[OpenLayers-Users] Correct way to replace the layers in a map with a completely new set?

Phil Scadden p.scadden at gns.cri.nz
Sun Apr 25 18:59:23 EDT 2010


> how do you "destroy" the layers? Do you use map.removeLayer()? You could
> add the new baselayer first and then remove the old ones. But without
> some example code which shows the problem it is difficult to help you ...
>    
Yes, I am using remove layers, but each layer removal triggers a heap of 
event processing that would be
more appropriate if done in one go - I was looking for a 
"removeAllLayers" type method that suppressed unnecessary event calling. 
I have done the adding new layers first - its when it decides that the 
one of new
layers is the new baselayer before it has finished removing all the old 
layers that triggers the problem. I'll see if I can nail exactly what 
causes the issue. Perhaps I need to remove all non-baselayers first, 
then rip through and remove the baselayers.

-- 
Phil Scadden, Senior Scientist GNS Science Ltd 764 Cumberland St, 
Private Bag 1930, Dunedin, New Zealand Ph +64 3 4799663, fax +64 3 477 5232

Notice: This email and any attachments are confidential. If received in error please destroy and immediately notify us. Do not copy or disclose the contents.




More information about the Users mailing list