-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsap.html
45 lines (42 loc) · 1.5 KB
/
sap.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" />
<title>Display a map</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/ol.css">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/ol.js"></script>
<style>
#map {position: absolute; top: 0; right: 0; bottom: 0; left: 0;}
</style>
</head>
<body>
<div id="map">
<a href="https://www.maptiler.com" style="position:absolute;left:10px;bottom:10px;z-index:999;"><img src="https://api.maptiler.com/resources/logo.svg" alt="MapTiler logo"></a>
</div>
<script>
const key = 'RCLp6MyXlaoYjTu08Tgb';
const attribution = new ol.control.Attribution({
collapsible: false,
});
const source = new ol.source.TileJSON({
url: `https://api.maptiler.com/maps/openstreetmap/tiles.json?key=${key}`, // source URL
tileSize: 512,
crossOrigin: 'anonymous'
});
const map = new ol.Map({
layers: [
new ol.layer.Tile({
source: source
})
],
controls: ol.control.defaults.defaults({attribution: false}).extend([attribution]),
target: 'map',
view: new ol.View({
constrainResolution: true,
center: ol.proj.fromLonLat([16.62662018, 49.2125578]), // starting position [lng, lat]
zoom: 14 // starting zoom
})
});
</script>
</body>
</html>