I want to recenter the map when I switch base layers so the selected base
layer is in the viewport. The following code seems to work when the layer is
an Overlay but fails when it is a Base Layer.

os_street_view.events.register('visibilitychanged', this, function()
{
        var os_street_viewvisibility = os_street_view.visibility;               
                        
        if (os_street_viewvisibility == true)
        {                       
                var osExtent = new OpenLayers.Bounds();                         
        
                osExtent.extend(new OpenLayers.LonLat(-8, 50).transform(g,p));
                osExtent.extend(new OpenLayers.LonLat(6, 55).transform(g,p));
                osExtent.toBBOX();
                map.zoomToExtent(osExtent);                                     
                
        }
});

Any thoughts?

--
View this message in context: 
http://osgeo-org.1803224.n2.nabble.com/Recenter-map-when-Base-Layer-switched-tp7080041p7080041.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users

Reply via email to