-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
121 lines (104 loc) · 4.08 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<!DOCTYPE html>
<html>
<head>
<title>leaflet-xserver example</title>
<meta charset="utf-8" />
<meta content="yes" name="apple-mobile-web-app-capable">
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" name="viewport">
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css" />
<style>
body {
padding: 0;
margin: 0;
}
html,
body,
#map {
height: 100%;
}
</style>
</head>
<body>
<div id="map"></div>
<script src="https://unpkg.com/[email protected]/dist/leaflet-src.js"></script>
<!-- <script src="https://unpkg.com/[email protected]/dist/leaflet-xserver-src.js"></script> -->
<script src="./dist/leaflet-xserver-src.js"></script>
<script src="./token.js"></script>
<script>
var coordinate = L.latLng(49.01405, 8.4044); // KA
var radius = 250; // m
var map = L.map('map', {
fullscreenControl: true
}).setView(coordinate, 14);
// insert a standard xServer base map.
// leaflet-xsrever sets the correct attribution text automatically
var basemapLayer = L.tileLayer(
'https://s0{s}-xserver2-europe-test.cloud.ptvgroup.com/services/rest/XMap/tile/{z}/{x}/{y}' +
'?storedProfile={profile}&layers={layers}&xtok={token}', {
profile: 'silkysand',
layers: 'background,transport',
token: window.token,
subdomains: '1234',
maxZoom: 22,
pane: 'tilePane'
}).addTo(map);
var circle = L.circle(coordinate, radius, {
color: 'red',
fillColor: 'orange',
fillOpacity: 0.5,
pane: 'overlayPane',
attribution: 'My Circle'
}).addTo(map).bindPopup("I am a circle.");
// create a new pane for our overlay layer
map.createPane('clickableTiles');
map.getPane('clickableTiles').style.zIndex = 500;
// add a tile layer with clickable json tiles, using L.tilelayer.server
var truckAttributesLayer = L.tileLayer.xserver(
'https://s0{s}-xserver2-europe-test.cloud.ptvgroup.com/services/rest/XMap/tile/{z}/{x}/{y}' +
'?storedProfile={profile}&layers={layers}&contentType=JSON&xtok={token}', {
// disableMouseEvents: true,
profile: 'silkysand',
layers: 'labels,PTV_TruckAttributes',
token: window.token,
subdomains: '1234',
maxZoom: 22,
pane: 'clickableTiles'
}).addTo(map);
// test for /rs api
// var truckAttributesLayer = L.tileLayer.xserver(
// 'https://s0{s}-xserver2-test.cloud.ptvgroup.com/services/rs/XMap/renderMap',
// {
// requestExtension: {
// "storedProfile": "gravelpit",
// "requestProfile": {
// "featureLayerProfile": {
// "themes": [{
// "enabled": true,
// "id": "PTV_TruckAttributes"
// }]
// }
// },
// "resultFields": {
// "featureThemeIds": ["PTV_TruckAttributes"]
// }
// },
// username: 'xtok',
// password: window.token,
// attribution: '<a target="_blank" href="http://www.ptvgroup.com">PTV</a>, HERE',
// subdomains: '1234',
// maxZoom: 22,
// pane: 'tilePane'
// }).addTo(map);
// Add a layer switcher
var layers = {
"Base Map": basemapLayer,
"Circle": circle,
"Truck Attributes": truckAttributesLayer
};
L.control.layers({}, layers, {
position: 'bottomleft',
autoZIndex: false
}).addTo(map);
</script>
</body>
</html>