[OpenLayers-Users] Use a select box to switch layers or position layerswitcher outside map?

Fernando Mano frmano at tecgraf.puc-rio.br
Wed Oct 31 11:52:56 EDT 2007


Haven't specifically done this, but for a quick hack, you can try doing 
this:
- hide the layer switcher div, so it can't be seen or clicked at.
- take a look at Control.LayerSwitcher. There you can find the methods 
for registering click events on the layers (you'll probably change it so 
the events are not registered), and the method that is called when a 
click happens. After a quick glance, it seems to me that other than this 
you'll just have to change a bit the updateMap function, so it receives 
a parameter saying what is the correct layer and sets it, instead of 
going through the baseLayers list. Then, set a javascript function on 
your radio box to call that update function, and there you are.
Hope it helps, feel free to email any questions - I'll try to give you a 
more complete help when I have time, in case you need it.

Ali Khan wrote:
> Hey, I've been trying to get the layer switcher out of the map but if I 
> pull it out the switcher always snaps to the top right section of the 
> browser screen rather than where I position it in the page, are there 
> any fixes to this?
>
> I have 50+ Layers which a person can select from. I was hoping if I 
> could not fix the above method I could use a select or radio box system 
> where one could click the choice and it would load in the layer using a 
> custom javascript function. Has anyone done anything similar to this 
> before? Any help would be much appreciated.
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>
>   




More information about the Users mailing list