tileserver-gl-light 4.4.1 → 4.4.2
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/package.json +1 -1
- package/public/templates/data.tmpl +16 -10
- package/public/templates/index.tmpl +2 -2
- package/public/templates/viewer.tmpl +15 -11
- package/src/serve_data.js +1 -1
- package/run.sh +0 -37
package/package.json
CHANGED
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
6
6
|
<title>{{name}} - TileServer GL</title>
|
|
7
7
|
{{#is_vector}}
|
|
8
|
-
<link rel="stylesheet" type="text/css" href="{{public_url}}maplibre-gl.css
|
|
9
|
-
<link rel="stylesheet" type="text/css" href="{{public_url}}maplibre-gl-inspect.css
|
|
10
|
-
<script>if (typeof Symbol !== 'undefined') { document.write('<script src="{{public_url}}maplibre-gl.js
|
|
11
|
-
<script>if (typeof Symbol !== 'undefined') { document.write('<script src="{{public_url}}maplibre-gl-inspect.min.js
|
|
8
|
+
<link rel="stylesheet" type="text/css" href="{{public_url}}maplibre-gl.css" />
|
|
9
|
+
<link rel="stylesheet" type="text/css" href="{{public_url}}maplibre-gl-inspect.css" />
|
|
10
|
+
<script>if (typeof Symbol !== 'undefined') { document.write('<script src="{{public_url}}maplibre-gl.js"><\/script>'); } else { document.write('<script src="{{public_url}}maplibre-gl-compat.js"><\/script>'); }</script>
|
|
11
|
+
<script>if (typeof Symbol !== 'undefined') { document.write('<script src="{{public_url}}maplibre-gl-inspect.min.js"><\/script>'); } else { document.write('<script src="{{public_url}}maplibre-gl-inspect-compat.min.js"><\/script>'); }</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;}
|
|
@@ -18,10 +18,10 @@
|
|
|
18
18
|
</style>
|
|
19
19
|
{{/is_vector}}
|
|
20
20
|
{{^is_vector}}
|
|
21
|
-
<link rel="stylesheet" type="text/css" href="{{public_url}}leaflet.css
|
|
22
|
-
<script src="{{public_url}}leaflet.js
|
|
23
|
-
<script src="{{public_url}}leaflet-hash.js
|
|
24
|
-
<script src="{{public_url}}L.TileLayer.NoGap.js
|
|
21
|
+
<link rel="stylesheet" type="text/css" href="{{public_url}}leaflet.css" />
|
|
22
|
+
<script src="{{public_url}}leaflet.js"></script>
|
|
23
|
+
<script src="{{public_url}}leaflet-hash.js"></script>
|
|
24
|
+
<script src="{{public_url}}L.TileLayer.NoGap.js"></script>
|
|
25
25
|
<style>
|
|
26
26
|
body { margin:0; padding:0; }
|
|
27
27
|
#map { position:absolute; top:0; bottom:0; width:100%; }
|
|
@@ -35,6 +35,9 @@
|
|
|
35
35
|
<div id="layerList"></div>
|
|
36
36
|
<pre id="propertyList"></pre>
|
|
37
37
|
<script>
|
|
38
|
+
var keyMatch = location.search.match(/[\?\&]key=([^&]+)/i);
|
|
39
|
+
var keyParam = keyMatch ? '?key=' + keyMatch[1] : '';
|
|
40
|
+
|
|
38
41
|
var map = new maplibregl.Map({
|
|
39
42
|
container: 'map',
|
|
40
43
|
hash: true,
|
|
@@ -44,7 +47,7 @@
|
|
|
44
47
|
sources: {
|
|
45
48
|
'vector_layer_': {
|
|
46
49
|
type: 'vector',
|
|
47
|
-
url: '{{public_url}}data/{{id}}.json
|
|
50
|
+
url: '{{public_url}}data/{{id}}.json' + keyParam
|
|
48
51
|
}
|
|
49
52
|
},
|
|
50
53
|
layers: []
|
|
@@ -76,11 +79,14 @@
|
|
|
76
79
|
<h1 style="display:none;">{{name}}</h1>
|
|
77
80
|
<div id='map'></div>
|
|
78
81
|
<script>
|
|
82
|
+
var keyMatch = location.search.match(/[\?\&]key=([^&]+)/i);
|
|
83
|
+
var keyParam = keyMatch ? '?key=' + keyMatch[1] : '';
|
|
84
|
+
|
|
79
85
|
var map = L.map('map', { zoomControl: false });
|
|
80
86
|
new L.Control.Zoom({ position: 'topright' }).addTo(map);
|
|
81
87
|
|
|
82
88
|
var tile_urls = [], tile_attribution, tile_minzoom, tile_maxzoom;
|
|
83
|
-
var url = '{{public_url}}data/{{id}}.json
|
|
89
|
+
var url = '{{public_url}}data/{{id}}.json' + keyParam;
|
|
84
90
|
var req = new XMLHttpRequest();
|
|
85
91
|
req.overrideMimeType("application/json");
|
|
86
92
|
req.open('GET', url, true);
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<meta charset="UTF-8">
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
6
6
|
<title>TileServer GL - Server for vector and raster maps with GL styles</title>
|
|
7
|
-
<link rel="stylesheet" type="text/css" href="{{public_url}}index.css
|
|
7
|
+
<link rel="stylesheet" type="text/css" href="{{public_url}}index.css" />
|
|
8
8
|
<script>
|
|
9
9
|
function toggle_xyz(id) {
|
|
10
10
|
var el = document.getElementById(id);
|
|
@@ -110,4 +110,4 @@
|
|
|
110
110
|
</p>
|
|
111
111
|
</footer>
|
|
112
112
|
</body>
|
|
113
|
-
</html>
|
|
113
|
+
</html>
|
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
<meta charset="UTF-8">
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
6
6
|
<title>{{name}} - TileServer GL</title>
|
|
7
|
-
<link rel="stylesheet" type="text/css" href="{{public_url}}maplibre-gl.css
|
|
8
|
-
<link rel="stylesheet" type="text/css" href="{{public_url}}maplibre-gl-inspect.css
|
|
9
|
-
<link rel="stylesheet" type="text/css" href="{{public_url}}leaflet.css
|
|
10
|
-
<script>if (typeof Symbol !== 'undefined') { document.write('<script src="{{public_url}}maplibre-gl.js
|
|
11
|
-
<script>if (typeof Symbol !== 'undefined') { document.write('<script src="{{public_url}}maplibre-gl-inspect.min.js
|
|
12
|
-
<script src="{{public_url}}leaflet.js
|
|
13
|
-
<script src="{{public_url}}leaflet-hash.js
|
|
14
|
-
<script src="{{public_url}}L.TileLayer.NoGap.js
|
|
7
|
+
<link rel="stylesheet" type="text/css" href="{{public_url}}maplibre-gl.css" />
|
|
8
|
+
<link rel="stylesheet" type="text/css" href="{{public_url}}maplibre-gl-inspect.css" />
|
|
9
|
+
<link rel="stylesheet" type="text/css" href="{{public_url}}leaflet.css" />
|
|
10
|
+
<script>if (typeof Symbol !== 'undefined') { document.write('<script src="{{public_url}}maplibre-gl.js"><\/script>'); } else { document.write('<script src="{{public_url}}maplibre-gl-compat.js"><\/script>'); }</script>
|
|
11
|
+
<script>if (typeof Symbol !== 'undefined') { document.write('<script src="{{public_url}}maplibre-gl-inspect.min.js"><\/script>'); } else { document.write('<script src="{{public_url}}maplibre-gl-inspect-compat.min.js"><\/script>'); }</script>
|
|
12
|
+
<script src="{{public_url}}leaflet.js"></script>
|
|
13
|
+
<script src="{{public_url}}leaflet-hash.js"></script>
|
|
14
|
+
<script src="{{public_url}}L.TileLayer.NoGap.js"></script>
|
|
15
15
|
<style>
|
|
16
16
|
body { margin:0; padding:0; }
|
|
17
17
|
#map { position:absolute; top:0; bottom:0; width:100%; }
|
|
@@ -26,11 +26,15 @@
|
|
|
26
26
|
q.indexOf('vector') >= 0 ? 'vector' :
|
|
27
27
|
(q.indexOf('raster') >= 0 ? 'raster' :
|
|
28
28
|
(maplibregl.supported() ? 'vector' : 'raster'));
|
|
29
|
+
|
|
30
|
+
var keyMatch = location.search.match(/[\?\&]key=([^&]+)/i);
|
|
31
|
+
var keyParam = keyMatch ? '?key=' + keyMatch[1] : '';
|
|
32
|
+
|
|
29
33
|
if (preference == 'vector') {
|
|
30
|
-
maplibregl.setRTLTextPlugin('{{public_url}}mapbox-gl-rtl-text.js
|
|
34
|
+
maplibregl.setRTLTextPlugin('{{public_url}}mapbox-gl-rtl-text.js' + keyParam);
|
|
31
35
|
var map = new maplibregl.Map({
|
|
32
36
|
container: 'map',
|
|
33
|
-
style: '{{public_url}}styles/{{id}}/style.json
|
|
37
|
+
style: '{{public_url}}styles/{{id}}/style.json' + keyParam,
|
|
34
38
|
hash: true,
|
|
35
39
|
maplibreLogo: true
|
|
36
40
|
});
|
|
@@ -49,7 +53,7 @@
|
|
|
49
53
|
new L.Control.Zoom({ position: 'topright' }).addTo(map);
|
|
50
54
|
|
|
51
55
|
var tile_urls = [], tile_attribution, tile_minzoom, tile_maxzoom;
|
|
52
|
-
var url = '{{public_url}}styles/{{id}}.json
|
|
56
|
+
var url = '{{public_url}}styles/{{id}}.json' + keyParam;
|
|
53
57
|
var req = new XMLHttpRequest();
|
|
54
58
|
req.overrideMimeType("application/json");
|
|
55
59
|
req.open('GET', url, true);
|
package/src/serve_data.js
CHANGED
|
@@ -8,7 +8,7 @@ import clone from 'clone';
|
|
|
8
8
|
import express from 'express';
|
|
9
9
|
import MBTiles from '@mapbox/mbtiles';
|
|
10
10
|
import Pbf from 'pbf';
|
|
11
|
-
import VectorTile from '@mapbox/vector-tile';
|
|
11
|
+
import { VectorTile } from '@mapbox/vector-tile';
|
|
12
12
|
|
|
13
13
|
import { getTileUrls, fixTileJSONCenter } from './utils.js';
|
|
14
14
|
|
package/run.sh
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
_term() {
|
|
4
|
-
echo "Caught signal, stopping gracefully"
|
|
5
|
-
kill -TERM "$child" 2>/dev/null
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
trap _term SIGTERM
|
|
9
|
-
trap _term SIGINT
|
|
10
|
-
|
|
11
|
-
xvfbMaxStartWaitTime=60
|
|
12
|
-
displayNumber=99
|
|
13
|
-
screenNumber=0
|
|
14
|
-
|
|
15
|
-
# Delete files if they were not cleaned by last run
|
|
16
|
-
rm -rf /tmp/.X11-unix /tmp/.X${displayNumber}-lock ~/xvfb.pid
|
|
17
|
-
|
|
18
|
-
echo "Starting Xvfb on display ${displayNumber}"
|
|
19
|
-
start-stop-daemon --start --pidfile ~/xvfb.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :${displayNumber} -screen ${screenNumber} 1024x768x24 -ac +extension GLX +render -noreset
|
|
20
|
-
|
|
21
|
-
# Wait to be able to connect to the port. This will exit if it cannot in 1 minute.
|
|
22
|
-
timeout ${xvfbMaxStartWaitTime} bash -c "while ! xdpyinfo -display :${displayNumber} >/dev/null; do sleep 0.5; done"
|
|
23
|
-
if [ $? -ne 0 ]; then
|
|
24
|
-
echo "Could not connect to display ${displayNumber} in ${xvfbMaxStartWaitTime} seconds time."
|
|
25
|
-
exit 1
|
|
26
|
-
fi
|
|
27
|
-
|
|
28
|
-
export DISPLAY=:${displayNumber}.${screenNumber}
|
|
29
|
-
|
|
30
|
-
echo
|
|
31
|
-
cd /data
|
|
32
|
-
node /usr/src/app/ "$@" &
|
|
33
|
-
child=$!
|
|
34
|
-
wait "$child"
|
|
35
|
-
|
|
36
|
-
start-stop-daemon --stop --retry 5 --pidfile ~/xvfb.pid # stop xvfb when exiting
|
|
37
|
-
rm ~/xvfb.pid
|