Files
openlayers/examples/preload.js
Frederic Junod 79c8afdba8 Simplify import path in examples
To have the same path (starting with `ol/`, without `.js`) as in the documentation.
The support was added in the webpack config in #8928
2018-11-26 17:18:52 +01:00

39 lines
780 B
JavaScript

import Map from 'ol/Map';
import View from 'ol/View';
import TileLayer from 'ol/layer/Tile';
import BingMaps from 'ol/source/BingMaps';
const view = new View({
center: [-4808600, -2620936],
zoom: 8
});
const map1 = new Map({
layers: [
new TileLayer({
preload: Infinity,
source: new BingMaps({
key: 'As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5',
imagerySet: 'Aerial'
})
})
],
target: 'map1',
view: view
});
const map2 = new Map({
layers: [
new TileLayer({
preload: 0, // default value
source: new BingMaps({
key: 'As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5',
imagerySet: 'AerialWithLabels'
})
})
],
target: 'map2',
view: view
});