[OpenLayers-Users] OpenStreetMap - trying to limit zoom levels

Christopher Schmidt crschmidt at metacarta.com
Thu Dec 13 12:54:18 EST 2007


On Thu, Dec 13, 2007 at 09:30:42AM -0800, The Bun 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/",
> 		{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?

There probably isn't a way to do this with the current code.

Regards,
-- 
Christopher Schmidt
MetaCarta



More information about the Users mailing list