[OpenLayers-Users] Changing the Layer displayed by a WMS
jdb@mail.nerc-essc.ac.uk
jdb at mail.nerc-essc.ac.uk
Mon Jul 24 02:16:22 CDT 2006
Dear Christopher,
The changeParams() function is exactly what I need. However, this
function does
not seem to be available in either the 1.0 release of OpenLayers
(http://openlayers.org/download/OpenLayers-1.0.tar.gz) or the latest version
that's hosted on the web (http://openlayers.org/api/OpenLayers.js). The
function *does* appear if I link to the version of OpenLayers.js that is used
in the examples section of the website
(http://openlayers.org/dev/lib/OpenLayers.js).
Is the changeParams() function still somewhat experimental? (Seems to
work for
me anyway!)
Thanks, Jon
Quoting Christopher Schmidt <crschmidt at crschmidt.net>:
> 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
>
----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
More information about the Users
mailing list