tileserver-gl-light 4.4.10 → 4.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/ci.yml +2 -2
- package/.github/workflows/codeql.yml +1 -1
- package/.github/workflows/ct.yml +2 -2
- package/.github/workflows/pipeline.yml +3 -3
- package/.github/workflows/release.yml +1 -1
- package/docs/deployment.rst +3 -3
- package/docs/endpoints.rst +8 -7
- package/package.json +4 -4
- package/public/resources/maplibre-gl.css +1 -1
- package/public/resources/maplibre-gl.js +8 -4
- package/public/resources/maplibre-gl.js.map +1 -1
- package/public/templates/data.tmpl +43 -42
- package/public/templates/viewer.tmpl +21 -4
- package/src/serve_rendered.js +292 -299
- package/src/server.js +0 -2
- package/src/utils.js +0 -1
- package/test/static.js +12 -0
- package/public/resources/maplibre-gl-compat.css +0 -1
- package/public/resources/maplibre-gl-compat.js +0 -45
- package/public/resources/maplibre-gl-compat.js.map +0 -1
- package/public/resources/maplibre-gl-inspect-compat.min.js +0 -1
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
{{#is_vector}}
|
|
8
8
|
<link rel="stylesheet" type="text/css" href="{{public_url}}maplibre-gl.css{{&key_query}}" />
|
|
9
9
|
<link rel="stylesheet" type="text/css" href="{{public_url}}maplibre-gl-inspect.css{{&key_query}}" />
|
|
10
|
-
<script
|
|
11
|
-
<script
|
|
10
|
+
<script src="{{public_url}}maplibre-gl.js{{&key_query}}"></script>
|
|
11
|
+
<script src="{{public_url}}maplibre-gl-inspect.min.js{{&key_query}}"></script>
|
|
12
12
|
<style>
|
|
13
13
|
body {background:#fff;color:#333;font-family:Arial, sans-serif;}
|
|
14
14
|
#map {position:absolute;top:0;left:0;right:250px;bottom:0;}
|
|
@@ -54,6 +54,7 @@
|
|
|
54
54
|
container: 'map',
|
|
55
55
|
hash: true,
|
|
56
56
|
maplibreLogo: true,
|
|
57
|
+
maxPitch: 85,
|
|
57
58
|
style: {
|
|
58
59
|
version: 8,
|
|
59
60
|
sources: {
|
|
@@ -94,48 +95,48 @@
|
|
|
94
95
|
var keyMatch = location.search.match(/[\?\&]key=([^&]+)/i);
|
|
95
96
|
var keyParam = keyMatch ? '?key=' + keyMatch[1] : '';
|
|
96
97
|
|
|
97
|
-
|
|
98
|
-
|
|
98
|
+
var map = L.map('map', { zoomControl: false });
|
|
99
|
+
new L.Control.Zoom({ position: 'topright' }).addTo(map);
|
|
99
100
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
101
|
+
var tile_urls = [], tile_attribution, tile_minzoom, tile_maxzoom;
|
|
102
|
+
var url = '{{public_url}}data/{{id}}.json' + keyParam;
|
|
103
|
+
var req = new XMLHttpRequest();
|
|
104
|
+
req.overrideMimeType("application/json");
|
|
105
|
+
req.open('GET', url, true);
|
|
106
|
+
req.onload = function() {
|
|
107
|
+
var jsonResponse = JSON.parse(req.responseText);
|
|
108
|
+
for (key in jsonResponse) {
|
|
109
|
+
var keyl = key.toLowerCase();
|
|
110
|
+
switch(keyl) {
|
|
111
|
+
case "tiles":
|
|
112
|
+
tile_urls = jsonResponse[key];
|
|
113
|
+
break;
|
|
114
|
+
case "attribution":
|
|
115
|
+
tile_attribution = jsonResponse[key];
|
|
116
|
+
break;
|
|
117
|
+
case "minzoom":
|
|
118
|
+
tile_minzoom = jsonResponse[key];
|
|
119
|
+
break;
|
|
120
|
+
case "maxzoom":
|
|
121
|
+
tile_maxzoom = jsonResponse[key];
|
|
122
|
+
break;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
124
125
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
126
|
+
for (tile_url in tile_urls) {
|
|
127
|
+
L.tileLayer(tile_urls[tile_url], {
|
|
128
|
+
minZoom: tile_minzoom,
|
|
129
|
+
maxZoom: tile_maxzoom,
|
|
130
|
+
attribution: tile_attribution
|
|
131
|
+
}).addTo(map);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
map.eachLayer(function(layer) {
|
|
135
|
+
// do not add scale prefix even if retina display is detected
|
|
136
|
+
layer.scalePrefix = '.';
|
|
137
|
+
});
|
|
138
|
+
};
|
|
139
|
+
req.send(null);
|
|
139
140
|
|
|
140
141
|
setTimeout(function() {
|
|
141
142
|
new L.Hash(map);
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
<link rel="stylesheet" type="text/css" href="{{public_url}}maplibre-gl.css{{&key_query}}" />
|
|
8
8
|
<link rel="stylesheet" type="text/css" href="{{public_url}}maplibre-gl-inspect.css{{&key_query}}" />
|
|
9
9
|
<link rel="stylesheet" type="text/css" href="{{public_url}}leaflet.css{{&key_query}}" />
|
|
10
|
-
<script
|
|
11
|
-
<script
|
|
10
|
+
<script src="{{public_url}}maplibre-gl.js{{&key_query}}"></script>
|
|
11
|
+
<script src="{{public_url}}maplibre-gl-inspect.min.js{{&key_query}}"></script>
|
|
12
12
|
<script src="{{public_url}}leaflet.js{{&key_query}}"></script>
|
|
13
13
|
<script src="{{public_url}}leaflet-hash.js{{&key_query}}"></script>
|
|
14
14
|
<script src="{{public_url}}L.TileLayer.NoGap.js{{&key_query}}"></script>
|
|
@@ -33,11 +33,27 @@
|
|
|
33
33
|
<h1 style="display:none;">{{name}}</h1>
|
|
34
34
|
<div id='map'></div>
|
|
35
35
|
<script>
|
|
36
|
+
function isWebglSupported() {
|
|
37
|
+
if (window.WebGLRenderingContext) {
|
|
38
|
+
const canvas = document.createElement('canvas');
|
|
39
|
+
try {
|
|
40
|
+
const context = canvas.getContext('webgl2') || canvas.getContext('webgl');
|
|
41
|
+
if (context && typeof context.getParameter == 'function') {
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
} catch (e) {
|
|
45
|
+
// WebGL is supported, but disabled
|
|
46
|
+
}
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
// WebGL not supported
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
36
52
|
var q = (location.search || '').substr(1).split('&');
|
|
37
53
|
var preference =
|
|
38
54
|
q.indexOf('vector') >= 0 ? 'vector' :
|
|
39
55
|
(q.indexOf('raster') >= 0 ? 'raster' :
|
|
40
|
-
(
|
|
56
|
+
(isWebglSupported() ? 'vector' : 'raster'));
|
|
41
57
|
|
|
42
58
|
var keyMatch = location.search.match(/[\?\&]key=([^&]+)/i);
|
|
43
59
|
var keyParam = keyMatch ? '?key=' + keyMatch[1] : '';
|
|
@@ -48,7 +64,8 @@
|
|
|
48
64
|
container: 'map',
|
|
49
65
|
style: '{{public_url}}styles/{{id}}/style.json' + keyParam,
|
|
50
66
|
hash: true,
|
|
51
|
-
maplibreLogo: true
|
|
67
|
+
maplibreLogo: true,
|
|
68
|
+
maxPitch: 85
|
|
52
69
|
});
|
|
53
70
|
map.addControl(new maplibregl.NavigationControl({
|
|
54
71
|
visualizePitch: true,
|