-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
42 lines (37 loc) · 1.05 KB
/
index.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
<html lang="en">
<head>
<title>PTV Raster Map OpenLayers Tutorial</title>
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/ol.css"/>
<link rel="icon" href="../../favicon.ico" />
<style>
body { margin:5px; padding:5px; }
#map { width:100%; height:100%; }
</style>
</head>
<body>
<div id="map"></div>
<script type="text/javascript" src="https://unpkg.com/[email protected]/dist/ol.js"></script>
<script type="text/javascript">
const api_key = "YOUR_API_KEY";
const tileURL = "https://api.myptv.com/rastermaps/v1/image-tiles/{z}/{x}/{y}?apiKey=" + api_key;
// Karlsruhe
const view = new ol.View({
center: ol.proj.fromLonLat([8.4, 49]),
zoom: 13
});
const ptvTileLayer = new ol.layer.Tile({
source: new ol.source.XYZ({
url: tileURL,
layer: "ptv-raster",
maxZoom: 22,
attributions: "©" + new Date().getFullYear() + " PTV Logistics, HERE"
})
});
const map = new ol.Map({
target: "map",
layers: [ptvTileLayer],
view
});
</script>
</body>
</html>