[OpenLayers-Users] Recenter map when Base Layer switched
maw269
maw269 at gmail.com
Fri Dec 9 17:26:12 EST 2011
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.
More information about the Users
mailing list