[OpenLayers-Users] Changing the Layer displayed by a WMS
Christopher Schmidt
crschmidt at crschmidt.net
Fri Jul 21 11:56:04 CDT 2006
On Fri, Jul 21, 2006 at 05:38:26PM +0100, Jon Blower wrote:
> 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'});
Jon --
This seems like the kind of problem that the 'changeParams' call is well
suited for -- there is an example of this in
http://openlayers.org/dev/examples/wmst.html -- essentially, you would
do my_wms.changeParams({layers:'newlayer'});
This would change the params, and reinitialize the image array with the
new images.
Does this match your needs?
--
Christopher Schmidt
Web Developer
More information about the Users
mailing list