Bing Tiles with a Subset of Resolutions Example
http://openlayers.org/dev/examples/bing-tiles-restrictedzoom.html
Note: Navigation isn't there.
HTML
<link rel="stylesheet" href="http://openlayers.org/dev/theme/default/style.css">
<link rel="stylesheet" href="http://openlayers.org/dev/examples/style.css">
<script src="http://fbug.googlecode.com/svn/lite/branches/flexBox/content/firebug-lite-dev.js"></script>
<script src="http://openlayers.org/dev/OpenLayers.js"></script>
<h1 id="title">Bing Tiles with a Subset of Resolutions Example</h1>
<div id="tags">
bing tiles restrictedMinZoom numZoomLevels
</div>
<div id="shortdesc">Use Bing with direct tile access</div>
<div id="map" class="smallmap" style="height: 350px;"></div>
<div id="docs">
<p>
This example shows how to use the <code>maxResolution</code> and
<code>numZoomLevels</code> layer properties to restrict
the number of zoom levels displayed on the Bing layer.
</p><p>
See <a target="_blank" href="bing-tiles-restrictedzoom.js">bing-tiles-restrictedzoom.js</a>
for the source code.
</p>
</div>
<br />
<p>Note: Navigation isn't there. <a href="http://openlayers.org/dev/examples/bing-tiles-restrictedzoom.html">Original
OpenLayers Example</a>.</p>
CSS
.olControlAttribution {
left: 2px;
right: inherit;
bottom: 3px;
line-height: 11px;
}
JavaScript
(function($) {
// API key for http://openlayers.org. Please get your own at
// http://bingmapsportal.com/ and use that instead.
var apiKey = 'AqTGBsziZHIJYYxgivLBf0hVdrAk9mWO5cQcb8Yux8sW5M8c8opEC2lZqKR1ZZXf';
var map = new OpenLayers.Map('map', {
controls: [
new OpenLayers.Control.Attribution(),
new OpenLayers.Control.Navigation(),
new OpenLayers.Control.PanZoomBar(),
new OpenLayers.Control.LayerSwitcher()
]
});
var road = new OpenLayers.Layer.Bing({
name: 'Road tiles with all zoom levels',
type: 'Road',
key: apiKey
});
map.addLayers([road]);
map.setCenter(new OpenLayers.LonLat(-71.147, 42.472).transform(
new OpenLayers.Projection('EPSG:4326'), map.getProjectionObject()), 1);
// http://openconcept.ca/comment/6226#comment-6226
map.addControl(
new OpenLayers.Control.KeyboardDefaults({
observeElement: 'map'
}));
})(jQuery);