32 lines
1.0 KiB
JavaScript
32 lines
1.0 KiB
JavaScript
import Map from '../src/ol/Map.js';
|
|
import View from '../src/ol/View.js';
|
|
import MVT from '../src/ol/format/MVT.js';
|
|
import VectorTileLayer from '../src/ol/layer/VectorTile.js';
|
|
import VectorTileSource from '../src/ol/source/VectorTile.js';
|
|
import {Fill, Icon, Stroke, Style, Text} from '../src/ol/style.js';
|
|
|
|
|
|
const key = 'pk.eyJ1IjoiYWhvY2V2YXIiLCJhIjoiRk1kMWZaSSJ9.E5BkluenyWQMsBLsuByrmg';
|
|
|
|
const map = new Map({
|
|
layers: [
|
|
new VectorTileLayer({
|
|
declutter: true,
|
|
source: new VectorTileSource({
|
|
attributions: '© <a href="https://www.mapbox.com/map-feedback/">Mapbox</a> ' +
|
|
'© <a href="https://www.openstreetmap.org/copyright">' +
|
|
'OpenStreetMap contributors</a>',
|
|
format: new MVT(),
|
|
url: 'https://{a-d}.tiles.mapbox.com/v4/mapbox.mapbox-streets-v6/' +
|
|
'{z}/{x}/{y}.vector.pbf?access_token=' + key
|
|
}),
|
|
style: createMapboxStreetsV6Style(Style, Fill, Stroke, Icon, Text)
|
|
})
|
|
],
|
|
target: 'map',
|
|
view: new View({
|
|
center: [0, 0],
|
|
zoom: 2
|
|
})
|
|
});
|