I have done this by having an array of zoom max/mins and then I control my own layer list in a form. Its a long winded way but it works for me.
Have a look at http://demo.cubewerx.com.au/osdm/interopdemo.html I set up an event that monitors the zooming and activates/deactivates these controls map.events.register('zoomend', null, function(evt) { var macroCheckBox = document.getElementById('macro'); zmlevel= map.getZoom(); // run through the layer controls array setting Checkbox to deactive for (j=0; j<numLayers; j++) { var layId= 'layer'+j; var layerCheckbox = document.getElementById(layId) // if the layer is viewable at this layer set the checkbox to reflect if (zmlevel < Minzm[j] || zmlevel > Maxzm[j]) { layerCheckbox.disabled = true; layerCheckbox.checked=false; layerVisibility(layId); } else { layerCheckbox.disabled = false; if (macroCheckBox.checked) { layerCheckbox.ch ecked= true; layerVisibility( layId); } } } Event.stop(evt); }); You will need to build your own layerVisibility() function that will just run through the checkboxes and activate/deactivate the visibility of the layer accordingly. Hope this helps Cheers, Brad Spencer -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Linda Rawson Sent: Friday, 14 December 2007 4:57 AM To: The Bun Cc: [email protected] Subject: Re: [OpenLayers-Users] OpenStreetMap - trying to limit zoom levels I think you have to customize PanZoomBar. Linda On Dec 13, 2007 10:30 AM, The Bun < [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> > wrote: Hi I am using OSM and connecting successfully to their mapnik server. Everything works OK, this is my code: map = new OpenLayers.Map ("map", { controls:[ new OpenLayers.Control.Permalink(), new OpenLayers.Control.MouseDefaults (), new OpenLayers.Control.LayerSwitcher(), new OpenLayers.Control.MousePosition(), new OpenLayers.Control.PanZoomBar()], maxExtent: new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34), numZoomLevels:17, maxResolution:156543, units:'meters', projection: "EPSG:41001"} ); layerMapnik = new OpenLayers.Layer.TMS( "Mapnik (updated weekly)", " http://tile.openstreetmap.org/mapnik/ <http://tile.openstreetmap.org/mapnik/> ", {type:'png', getURL: get_osm_url, displayOutsideMaxExtent: true }, {'buffer':1} ); etc. etc. What I am not understanding is how to limit the zoom levels to just from zoom 9 to zoom 16 I tried different ways: An array of scales, an array of resolutions, changing the maxResolution, change the numZoomLevels etc etc always failed, is there someone in the list who can help with this issue? Kind Regards Rosario Carbone -- View this message in context: http://www.nabble.com/OpenStreetMap---trying-to-limit-zoom-levels-tp14320769 p14320769.html Sent from the OpenLayers Users mailing list archive at Nabble.com <http://nabble.com/> . _______________________________________________ Users mailing list [email protected] <mailto:[email protected]> http://openlayers.org/mailman/listinfo/users
_______________________________________________ Users mailing list [email protected] http://openlayers.org/mailman/listinfo/users
