[OpenLayers-Users] Inducing LayerSwitcher to Update Through Programming

Bill Thoen bthoen at gisnet.com
Mon Feb 23 11:28:53 EST 2009


I've got a javascript application that changes the base layer of a map 
as one of its operations and I was wondering what the most correct way 
to update the LayerSwitcher control to reflect the changed base layer 
would be. In LayerSwitcher.js I didn't see an obvious function like 
setBaseLayer() or similar, and redraw() alone doesn't react to a changed 
base layer. So what I did was set layerStates.length = 0 and called 
redraw(). This works, but I was wondering if this is the best way to 
handle it?

- Bill Thoen



More information about the Users mailing list