[OpenLayers-Dev] Changing the WMS displayed on button click

Christopher Schmidt crschmidt at metacarta.com
Tue Jun 3 07:45:22 EDT 2008

On Tue, Jun 03, 2008 at 06:26:13PM +1000, Darko Radiceski wrote:
> Greetings all,
> I have 2 map displays on the page each displaying different set of data. For
> example Aerial image views from two different areas.
> Is it possible to have button controlls outside the map that when clicked
> they will change the data displayed in the map display?
> Essentially i would like to point to a different WMS layer. Similar to what
> the layer switcher does but i would like to do that through an external
> button.
> I was thinking of maybe on the button click to destroy the layer on the two
> maps and then re-add the new layers. I dont know if this would be the most
> productive way?

map.setBaseLayer(), and for overlays, layer.setVisibility(bool)
are the methods that the LayerSwitcher uses.

Christopher Schmidt

More information about the Dev mailing list