[OpenLayers-Users] Layer Switcher Question

Christian López Espínola penyaskito at gmail.com
Fri Jan 25 18:21:44 EST 2008


And you should listen to the changebaselayer event...

Something like

this.map.events.register("changebaselayer", this, updateActiveLayerName);

and

function updateActiveLayerName(evt) {
    document.getElementById("mylbl").innerText = map.baseLayer.name;
}


This code is untested (written directly on the mail), but gives you a hint.

On Jan 26, 2008 12:09 AM, Eric Lemoine <eric.c2c at gmail.com> wrote:
> On Jan 25, 2008 7:01 PM, D. Eric Keefauver <eric.keefauver at mtu.edu> wrote:
> > Hello all,
> >
> > I apologize if this should be a developer post but I am curious as to how
> > one might capture the base layer name that is active base layer within the
> > layer switcher and place it on the map page once the user collapses the
> > layer switcher. We want to have a visual place holder for the active base
> > layer name so users are aware and always reminded of what they are
> > viewing.
>
> The base layer is referenced in the map object. For example to get the
> name of the base layer you do map.baseLayer.name.
>
> Hope I'm answering your question...
>
> --
> Eric
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>



-- 
Regards,

Christian López Espínola


More information about the Users mailing list