[OpenLayers-Users] linking layerswitcher and overview map
Janis Elmeris
janis.elmeris at intelligentsystems.lv
Fri May 20 05:20:34 EDT 2011
I'm doing it like this:
map = new OpenLayers.Map (...);
overviewMapControl = new OpenLayers.Control.OverviewMap (...);
// Update the base layer of the overview map along with the base
layer of the main map.
map.events.register ('changebaselayer', this, function (layer,
properties)
{
if (overviewMapControl.ovmap) {
overviewMapControl.ovmap.setBaseLayer
(overviewMapControl.ovmap.getLayersByName (layer.layer.name)[0]);
}
// else the overview map is not drawn yet.
});
You must make sure that you've added to the overview map all the same
layers you added to the big map, and that they have unique names (the
first parameter for a layer constructor).
Janis
On 2011.05.19. 18:52, Sukuchha Shrestha wrote:
> Hello nice people,
>
> I want to synchronize the layerswitcher and overview map. I mean when
> i select my layerA in layerswitcher, the overview map should display
> layerA and similarly when i select my layerB in layerswitcher the
> overview map should display layerB.
>
> Any idea how to do it !
>
> thanks
> sukuchha
>
>
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20110520/014c4cfb/attachment.html
More information about the Users
mailing list