<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style>
</head>
<body class='hmmessage'><div dir='ltr'>
Hello,<br><br>I know this is an issue that was raised a few years ago - I noticed a few posts in 2007 - but I wonder if there is now solutions that I am not aware of.<br><br>I'm trying to limit extent and zoom levels of a map including Bing and OSM basemaps. I succeed to get to do what I want for the Bing side of things but I keep getting errors with the OSM layer... either I can't get it to show up at all or it won't restrict the extent and the zooms.<br><br>here is the relevant portion of code (I'll also put below a few variants I tried for the OSM layer)<br><br> map = new OpenLayers.Map('map_element', {<br> maxExtent: new OpenLayers.Bounds(<br> -504904.79024762,<br> 7109446.218042,<br> -138007.0545445,<br> 7476343.9537452),<br> units: 'm',<br> projection: new OpenLayers.Projection('EPSG:900913'),<br> maxResolution: 611.496226171875,<br> numZoomLevels: 10<br> });<br><br>// Basemaps<br> //Bing <br><br> var ve_road = new OpenLayers.Layer.VirtualEarth(<br> 'Bing Road',<br> {sphericalMercator:true}<br> );<br><br> var ve_aerial = new OpenLayers.Layer.VirtualEarth(<br> 'Bing Aerial',<br> {type: VEMapStyle.Aerial,<br> sphericalMercator:true}<br> );<br><br> //OpenStreetMap<br><br> var osm_layer = new OpenLayers.Layer.OSM(<br> 'OpenStreetMap Layer',<br> ' ',<br> {sphericalMercator:true,<br> maxResolution: 611.496226171875,<br> numZoomLevels: 10}<br> );<br><br>now for the osm_layer I have also tried (which doesn't work either)<br> var osm_layer = new OpenLayers.Layer.OSM(<br>
'OpenStreetMap Layer',<br>
{sphericalMercator:true,<br>
maxResolution: 611.496226171875,<br>
numZoomLevels: 10}<br>
);<br><br>and (which works but doesn't limit the zooms)<br><br> var osm_layer = new OpenLayers.Layer.OSM(<br>
'OpenStreetMap Layer'<br>
);<br><br>I know I'm doing something wrong somewhere and there are faults in my code... Could anyone help me?<br><br> Thank you,<br><br> Delphine<br><br>                                            </div></body>
</html>