UNPKG

1.09 kBJavaScriptView Raw
1goog.require('ol.Map');
2goog.require('ol.View');
3goog.require('ol.control');
4goog.require('ol.layer.Tile');
5goog.require('ol.source.OSM');
6
7
8var openCycleMapLayer = new ol.layer.Tile({
9 source: new ol.source.OSM({
10 attributions: [
11 'All maps © <a href="https://www.opencyclemap.org/">OpenCycleMap</a>',
12 ol.source.OSM.ATTRIBUTION
13 ],
14 url: 'https://{a-c}.tile.thunderforest.com/cycle/{z}/{x}/{y}.png' +
15 '?apikey=0e6fc415256d4fbb9b5166a718591d71'
16 })
17});
18
19var openSeaMapLayer = new ol.layer.Tile({
20 source: new ol.source.OSM({
21 attributions: [
22 'All maps © <a href="http://www.openseamap.org/">OpenSeaMap</a>',
23 ol.source.OSM.ATTRIBUTION
24 ],
25 opaque: false,
26 url: 'https://tiles.openseamap.org/seamark/{z}/{x}/{y}.png'
27 })
28});
29
30
31var map = new ol.Map({
32 layers: [
33 openCycleMapLayer,
34 openSeaMapLayer
35 ],
36 target: 'map',
37 controls: ol.control.defaults({
38 attributionOptions: {
39 collapsible: false
40 }
41 }),
42 view: new ol.View({
43 maxZoom: 18,
44 center: [-244780.24508882355, 5986452.183179816],
45 zoom: 15
46 })
47});