[OpenLayers-Users] zooming out when changing base layer
Bart van den Eijnden (OSGIS)
bartvde at osgis.nl
Mon Dec 11 06:40:51 EST 2006
Hi Erik,
but with WMS Untiled, I do not specify an extent nor a resolution for a
layer.
How does this relate then to WMS Untiled? Is there a way around it?
This is my code:
function mapinit(){
map = new OpenLayers.Map( $('map'), { controls: [],
'projection': 'EPSG:28992', 'units':'meters', 'maxExtent': new
OpenLayers.Bounds(-157973.103596, 300670.145842, 472056.321374,
678687.800824) , 'maxResolution':'auto'}); var layer = new
OpenLayers.Layer.WMS.Untiled( "Topografische kaart Nederland",
"http://intranet.rijkswaterstaat.nl/services/geoservices/basispakket/topografie?",
{layers: 'AAA126,AAA127,AAA134', 'format':'image/jpeg',
'transparent':'true'}, {'ratio':1, isBaseLayer: true} );
map.addLayers([layer]); var layer = new
OpenLayers.Layer.WMS.Untiled( "Luchtfoto's Nederland",
"http://intranet.rijkswaterstaat.nl/services/geoservices/basispakket/luchtfoto?",
{layers: 'AAA216', 'format':'image/jpeg', 'transparent':'true'}, {'ratio':1,
isBaseLayer: true} );
map.addLayers([layer]); var layer = new
OpenLayers.Layer.WMS.Untiled( "Nationaal Wegen Bestand Wegen wegvakken",
"http://intranet.rijkswaterstaat.nl/services/geoservices/basispakket/nationaalwegenbestand?",
{layers: 'AAA70', 'format':'image/gif', 'transparent':'true'}, {'ratio':1,
isBaseLayer: false} );
map.addLayers([layer]); var layer = new
OpenLayers.Layer.WMS.Untiled( "Top250namen",
"http://intranet.rijkswaterstaat.nl/services/geoservices/basispakket/topografie?",
{layers: 'AAA133', 'format':'image/gif', 'transparent':'true'}, {'ratio':1,
isBaseLayer: false} );
map.addLayers([layer]); if (!map.getCenter())
map.zoomToMaxExtent();
map.addControl(new OpenLayers.Control.LayerSwitcher());
map.addControl(new OpenLayers.Control.PanZoomBar());
map.addControl(new OpenLayers.Control.MouseDefaults());
}
Best regards,
Bart
--
Bart van den Eijnden
OSGIS, Open Source GIS
http://www.osgis.nl
--------- Oorspronkelijk bericht --------
Van: Erik Uzureau <euzuro at gmail.com>
Naar: Bart van den Eijnden OSGIS <bartvde at osgis.nl>
Cc: users at openlayers.org
Onderwerp: Re: [OpenLayers-Users] zooming out when changing base layer
Datum: 11/12/06 09:16
> When you switch between base layers, OpenLayers tries to find the
> nearest approximate
> zoom for the new base layer.
>
> So what is happening is that when you switch from baselayer A to baselayer
B
>
> 1) records current extent of map in baselayer A
> 2) switches to base layer B
> 3) calls zoomToExtent() on stored extent from base layer A
>
> if the resolutions/scales array for your two base layers are not the same,
> this would explain the behaviour.
>
> Note that with the commercial layers (google, yahoo, etc) we have
specifically
> hard coded the resolutions array so that it will be more consistent with
wms
> layers (due to projection differences).
>
> On 12/11/06, Bart van den Eijnden (OSGIS) <bartvde at osgis.nl> wrote:
> > Hi list,
> >
> > I have 2 base layers and several overlays, all are WMS Untiled.
> >
> > When I change the base layer, the application zooms out.
> >
> > Is this a bug?
> >
> > Best regards,
> > Bart
> >
> > --
> > Bart van den Eijnden
> > OSGIS, Open Source GIS
> > http://www.osgis.nl
> >
> >
> >
> >
> >
> > _______________________________________________
> > Users mailing list
> > Users at openlayers.org
> > http://openlayers.org/mailman/listinfo/users
> >
>
>
More information about the Users
mailing list