[OpenLayers-Users] Bing zoom levels in 2.11

Andy Harrison andyh at alh.me.uk
Wed Jun 1 12:55:50 EDT 2011


On 01/06/2011 16:24, Andreas Hocevar wrote:
> Hi,
>
> use restrictedMinZoom and numZoomLevels. The latter starts counting at
> zoom level 0, regardless of the restrictedMinZoom setting.

Hi Andreas,

I always get Bing layers with 21 zoom levels no matter what. I've 
stripped down the "Basic Bing Tiles Example" and added these properties 
to the layer but still no success. I can restrict Google layers, but a 
Bing layer always gives 21 zoom levels. Maybe I missed something 
elementary, not sure? I usually pass "numZoomLevels" and "minZoomLevel" 
into the map object but this has had no effect either.

Andy.

// API key for http://openlayers.org. Please get your own at
// http://bingmapsportal.com/ and use that instead.
var apiKey = 
"Ag4F_HsaaZKANsHgsJdOHk1o2yM_IoPZ8jX0cY5aYXADpGxZKuPN2DNL6At3SnEK";
var map = new OpenLayers.Map('map');
var road = new OpenLayers.Layer.Bing({
     key: apiKey,
     type: "Road",
     numZoomLevels:14,
     restrictedMinZoom:12,
     metadataParams: {mapVersion: "v1"}
});

map.addLayers([road]);
map.addControl(new OpenLayers.Control.LayerSwitcher());
map.setCenter(new OpenLayers.LonLat(-71.147, 42.472).transform(
     new OpenLayers.Projection("EPSG:4326"),
     map.getProjectionObject()
),11);

map.events.on({"zoomend":function(){
     console.log(map.getZoom());
}});


More information about the Users mailing list