1 |
|
2 |
|
3 | goog.require('ol.Map');
|
4 | goog.require('ol.View');
|
5 | goog.require('ol.format.MVT');
|
6 | goog.require('ol.layer.VectorTile');
|
7 | goog.require('ol.source.VectorTile');
|
8 | goog.require('ol.style.Fill');
|
9 | goog.require('ol.style.Icon');
|
10 | goog.require('ol.style.Stroke');
|
11 | goog.require('ol.style.Style');
|
12 | goog.require('ol.style.Text');
|
13 |
|
14 |
|
15 | var key = 'pk.eyJ1IjoiYWhvY2V2YXIiLCJhIjoiRk1kMWZaSSJ9.E5BkluenyWQMsBLsuByrmg';
|
16 |
|
17 | var map = new ol.Map({
|
18 | layers: [
|
19 | new ol.layer.VectorTile({
|
20 | source: new ol.source.VectorTile({
|
21 | attributions: '© <a href="https://www.mapbox.com/map-feedback/">Mapbox</a> ' +
|
22 | '© <a href="https://www.openstreetmap.org/copyright">' +
|
23 | 'OpenStreetMap contributors</a>',
|
24 | format: new ol.format.MVT(),
|
25 | url: 'https://{a-d}.tiles.mapbox.com/v4/mapbox.mapbox-streets-v6/' +
|
26 | '{z}/{x}/{y}.vector.pbf?access_token=' + key
|
27 | }),
|
28 | style: createMapboxStreetsV6Style()
|
29 | })
|
30 | ],
|
31 | target: 'map',
|
32 | view: new ol.View({
|
33 | center: [0, 0],
|
34 | zoom: 2
|
35 | })
|
36 | });
|
37 |
|
38 |
|
39 |
|