I would like to have only 3 levels of zoom available (from level 6 to level 8).
demolayer2 = new OpenLayers.Layer.WMS(
"abc...","http://localhost:8080/geoserver/gwc/service/wms",
{layers: 'def...', transparent:"true", format: 'image/png', numZoomLevels: 3, minZoomLevel: 6 },{isBaseLayer:false},
{ tileSize: new OpenLayers.Size(256,256)});
map.addLayer(demolayer2);
map.addControl(new OpenLayers.Control.LayerSwitcher({'div':OpenLayers.Util.getElement('layerswitcher')}));
map.zoomToExtent(new OpenLayers.Bounds(-4.601615515076983,39.8769407866263,-3.0527184873294764,41.16710732525929));
Answer
One way of doing that (don't know if it's the only way) is by passing an array of available resolutions to the map constructor via the options parameter. Something like...
var map = new OpenLayers.Map('map', {
resolutions: [0.02197265625, 0.0439453125, 0.17578125]
});
A way to get the resolutions you are interested in could be:
1) zoom your map to a desired zoom level (I did it via console by running map.zoomTo(x)
where x
is the zoom level I was interested in)
2) via the console log the map.resolution
and take note of it
3) repeat for all the zoom levels you would like to include
You can find more in-depth information here.
No comments:
Post a Comment