[OpenLayers-Users] Switching to singleTile mode (and back) on the fly

Jon Blower jdb at mail.nerc-essc.ac.uk
Tue Dec 4 13:17:08 EST 2007


Hi Christopher,

> Have two layers, and switch between them? You don't have to display them
> both: when you switch, set the one you'r turning 'off' to
> displayInLayerSwitcher false, then call cahngebaseLayer (or
> setVisibility, if they are overlays) and change the layer.

I've just tried this and don't quite get the result I expect.  If I
change the property displayInLayerSwitcher after a layer has been
added to the map, nothing happens, even if I call
layerSwitcher.redraw().

Is there a way to add or remove a layer from the layer switcher after
the layer has been added to the map?

Thanks, Jon

On Nov 29, 2007 12:47 PM, Christopher Schmidt <crschmidt at metacarta.com> wrote:
> On Thu, Nov 29, 2007 at 12:20:43PM +0000, Jon Blower wrote:
> > Hi all,
> >
> > Is there a way to switch a WMS layer from gridded to singleTile mode
> > after it has been created?  I have a WMS that serves several different
> > types of layers - some work best displayed in gridded mode and some
> > work better in singleTile mode.  Therefore I'd like to be able to
> > switch between modes in Javascript.
>
> Have two layers, and switch between them? You don't have to display them
> both: when you switch, set the one you'r turning 'off' to
> displayInLayerSwitcher false, then call cahngebaseLayer (or
> setVisibility, if they are overlays) and change the layer.
>
> Regards,
> --
> Christopher Schmidt
> MetaCarta
>



-- 
--------------------------------------------------------------
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