Files
openlayers/examples/bing-maps.js
Andreas Hocevar 38b12d3149 Make map's deviceOptions map options
This removes the map's deviceOptions config option, and instead
introduces loadTilesWhileAnimating and loadTilesWhileInteracting map
options. By default, both are false now, to make zooming and panning
smoother on most devices.
2014-12-21 12:03:28 +01:00

50 lines
1.2 KiB
JavaScript

goog.require('ol.Map');
goog.require('ol.View');
goog.require('ol.layer.Tile');
goog.require('ol.source.BingMaps');
var styles = [
'Road',
'Aerial',
'AerialWithLabels',
'collinsBart',
'ordnanceSurvey'
];
var layers = [];
var i, ii;
for (i = 0, ii = styles.length; i < ii; ++i) {
layers.push(new ol.layer.Tile({
visible: false,
preload: Infinity,
source: new ol.source.BingMaps({
key: 'Ak-dzM4wZjSqTlzveKz5u0d4IQ4bRzVI309GxmkgSVr1ewS6iPSrOvOKhA-CJlm3',
imagerySet: styles[i]
// use maxZoom 19 to see stretched tiles instead of the BingMaps
// "no photos at this zoom level" tiles
// maxZoom: 19
})
}));
}
var map = new ol.Map({
layers: layers,
renderer: exampleNS.getRendererFromQueryString(),
// Improve user experience by loading tiles while dragging/zooming. Will make
// zooming choppy on mobile or slow devices.
loadTilesWhileInteracting: true,
target: 'map',
view: new ol.View({
center: [-6655.5402445057125, 6709968.258934638],
zoom: 13
})
});
$('#layer-select').change(function() {
var style = $(this).find(':selected').val();
var i, ii;
for (i = 0, ii = layers.length; i < ii; ++i) {
layers[i].setVisible(styles[i] == style);
}
});
$('#layer-select').trigger('change');