import Map from 'ol/Map'; import View from 'ol/View'; import MVT from 'ol/format/MVT'; import VectorTileLayer from 'ol/layer/VectorTile'; import VectorTileSource from 'ol/source/VectorTile'; import {Fill, Icon, Stroke, Style, Text} from 'ol/style'; const key = 'pk.eyJ1IjoiYWhvY2V2YXIiLCJhIjoiRk1kMWZaSSJ9.E5BkluenyWQMsBLsuByrmg'; const map = new Map({ layers: [ new VectorTileLayer({ declutter: true, source: new VectorTileSource({ attributions: '© Mapbox ' + '© ' + 'OpenStreetMap contributors', 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 }) });