[OpenLayers-Users] Preventing zoom out

Maria Panagou snowdrop at ath.forthnet.gr
Fri Jan 4 07:00:40 EST 2008


I don't think this is true. In my map I have default num of zoomlevels (16).
I also set the center of my map with 

var extent = new OpenLayers.Bounds( 20, 34.7, 28.5, 41.7)
        var map;

        function init(){
            map = new OpenLayers.Map( 'map' , 
            {restrictedExtent:extent,
			maxExtent:extent,
			maxResolution: 0.010986328125,
			controls: [new OpenLayers.Control.LayerSwitcher(),
				new OpenLayers.Control.PanZoomBar(),
				new OpenLayers.Control.MouseToolbar(),
				new OpenLayers.Control.MousePosition({prefix: 'ö: ', separator: ', ë:
'})],
				
				 theme:null});

var satellite = new OpenLayers.Layer.Google( "Google Satellite" , {type:
G_SATELLITE_MAP,'maxZoomLevel':16} );

var hybrid = new OpenLayers.Layer.Google( "Google Hybrid" , {type:
G_HYBRID_MAP });
			var dtm = new OpenLayers.Layer.WMS( "ICEDS (Integrated CEOS European Data
Server) WMS",
               "http://iceds.ge.ucl.ac.uk/cgi-bin/icedswms?", {layers:
"srtm"});

var quakes = new OpenLayers.Layer.WMS( "Óçìáíôéêïß Óåéóìïß", 
                       "http://127.0.0.1:80/cgi-bin/mapserv.exe?", 
                        {map: '../htdocs/mpanagou/Quakes.map', 
                          layers: 'Quakes',
						  transparent: true},
                          {isBaseLayer:false, singletile:true, reproject:
true});

map.setCenter(extent.getCenterLonLat,7);

so what i get is a map centered at my specified extent, zoomed at level 7
and one can zoom out to level 0 which is the whole world


well, I wasn't any help with the last your last question but lets see if I
can add some value :-)

I believe maxResolution is zoom level 0 on the map. If you don't specify a
resolution's array and only specify maxResolution and numZoomLevels (n)
every zoom level is the previous zoom level/2, e.g.,
Zoom0: maxResolution
Zoom1: maxResolution/2
Zoom2: Zoom1/2
Zoom3: Zoom2/2

hope that helps



-- 
View this message in context: http://www.nabble.com/Preventing-zoom-out-tp14608863p14614936.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.




More information about the Users mailing list