[OpenLayers-Users] Changing the Layer displayed by a WMS
Jon Blower
jdb at mail.nerc-essc.ac.uk
Fri Jul 21 11:38:26 CDT 2006
Hi all,
I've just started playing with OpenLayers and I think it's very promising.
I'm using it mainly to display maps from a WMS. I'd like to know how I can
dynamically change the WMS Layer that is being displayed. For example, I've
created a WMS layer like this:
var my_wms = new OpenLayers.Layer.WMS1_3("My WMS", "http://path.to/mywms?",
{layers: 'somelayer'});
I'd like to be able to change the "layers" parameter of the my_wms object in
response to a button click, i.e. something like this:
my_wms.setLayers('newlayer');
This would replace 'somelayer' with 'newlayer' from the same WMS and display
it.
Any help would be much appreciated!
Thanks, Jon
--------------------------------------------------------------
Dr Jon Blower Tel: +44 118 378 5213 (direct line)
Technical Director Tel: +44 118 378 8741 (ESSC)
Reading e-Science Centre Fax: +44 118 378 6413
ESSC Email: jdb at mail.nerc-essc.ac.uk
University of Reading
3 Earley Gate
Reading RG6 6AL, UK
--------------------------------------------------------------
More information about the Users
mailing list