tileserver-gl-light 4.4.1 → 4.4.3

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.
@@ -25,6 +25,18 @@
25
25
  <style>
26
26
  body { margin:0; padding:0; }
27
27
  #map { position:absolute; top:0; bottom:0; width:100%; }
28
+ .leaflet-control-layers-toggle {
29
+ background-image: url({{public_url}}images/layers.png{{&key_query}});
30
+ width: 36px;
31
+ height: 36px;
32
+ }
33
+ .leaflet-retina .leaflet-control-layers-toggle {
34
+ background-image: url({{public_url}}images/layers-2x.png{{&key_query}});
35
+ background-size: 26px 26px;
36
+ }
37
+ .leaflet-default-icon-path { /* used only in path-guessing heuristic, see L.Icon.Default */
38
+ background-image: url({{public_url}}images/marker-icon.png{{&key_query}});
39
+ }
28
40
  </style>
29
41
  {{/is_vector}}
30
42
  </head>
@@ -35,6 +47,9 @@
35
47
  <div id="layerList"></div>
36
48
  <pre id="propertyList"></pre>
37
49
  <script>
50
+ var keyMatch = location.search.match(/[\?\&]key=([^&]+)/i);
51
+ var keyParam = keyMatch ? '?key=' + keyMatch[1] : '';
52
+
38
53
  var map = new maplibregl.Map({
39
54
  container: 'map',
40
55
  hash: true,
@@ -44,7 +59,7 @@
44
59
  sources: {
45
60
  'vector_layer_': {
46
61
  type: 'vector',
47
- url: '{{public_url}}data/{{id}}.json{{&key_query}}'
62
+ url: '{{public_url}}data/{{id}}.json' + keyParam
48
63
  }
49
64
  },
50
65
  layers: []
@@ -76,11 +91,14 @@
76
91
  <h1 style="display:none;">{{name}}</h1>
77
92
  <div id='map'></div>
78
93
  <script>
94
+ var keyMatch = location.search.match(/[\?\&]key=([^&]+)/i);
95
+ var keyParam = keyMatch ? '?key=' + keyMatch[1] : '';
96
+
79
97
  var map = L.map('map', { zoomControl: false });
80
98
  new L.Control.Zoom({ position: 'topright' }).addTo(map);
81
99
 
82
100
  var tile_urls = [], tile_attribution, tile_minzoom, tile_maxzoom;
83
- var url = '{{public_url}}data/{{id}}.json{{&key_query}}';
101
+ var url = '{{public_url}}data/{{id}}.json' + keyParam;
84
102
  var req = new XMLHttpRequest();
85
103
  req.overrideMimeType("application/json");
86
104
  req.open('GET', url, true);
@@ -17,7 +17,7 @@
17
17
  </head>
18
18
  <body>
19
19
  <section>
20
- <h1 class="title {{#if is_light}}light{{/if}}"><img src="{{public_url}}images/logo.png" alt="TileServer GL" /></h1>
20
+ <h1 class="title {{#if is_light}}light{{/if}}"><img src="{{public_url}}images/logo.png{{&key_query}}" alt="TileServer GL" /></h1>
21
21
  <h2 class="subtitle">Vector {{#if is_light}}<s>and raster</s>{{else}}and raster{{/if}} maps with GL styles</h2>
22
22
  {{#if styles}}
23
23
  <h2 class="box-header">Styles</h2>
@@ -27,7 +27,7 @@
27
27
  {{#if thumbnail}}
28
28
  <img src="{{public_url}}styles/{{@key}}/{{thumbnail}}{{&../key_query}}" alt="{{name}} preview" />
29
29
  {{else}}
30
- <img src="{{public_url}}images/placeholder.png" alt="{{name}} preview" />
30
+ <img src="{{public_url}}images/placeholder.png{{&key_query}}" alt="{{name}} preview" />
31
31
  {{/if}}
32
32
  <div class="details">
33
33
  <h3>{{name}}</h3>
@@ -74,7 +74,7 @@
74
74
  {{#if thumbnail}}
75
75
  <img src="{{public_url}}data/{{@key}}/{{thumbnail}}{{&../key_query}}" alt="{{name}} preview" />
76
76
  {{else}}
77
- <img src="{{public_url}}images/placeholder.png" alt="{{name}} preview" />
77
+ <img src="{{public_url}}images/placeholder.png{{&key_query}}" alt="{{name}} preview" />
78
78
  {{/if}}
79
79
  <div class="details">
80
80
  <h3>{{name}}</h3>
@@ -104,10 +104,10 @@
104
104
  {{/if}}
105
105
  </section>
106
106
  <footer>
107
- <a href="https://www.maptiler.com/" target="_blank"><img src="{{public_url}}images/maptiler-logo.svg" /></a>
107
+ <a href="https://www.maptiler.com/" target="_blank"><img src="{{public_url}}images/maptiler-logo.svg{{&key_query}}" /></a>
108
108
  <p>
109
109
  <a href="https://github.com/maptiler/tileserver-gl" target="_blank">Powered by TileServer GL ({{server_version}})</a> – <a href="https://www.maptiler.com/" target="_blank">an open-source project from MapTiler.</a>
110
110
  </p>
111
111
  </footer>
112
112
  </body>
113
- </html>
113
+ </html>
@@ -15,6 +15,18 @@
15
15
  <style>
16
16
  body { margin:0; padding:0; }
17
17
  #map { position:absolute; top:0; bottom:0; width:100%; }
18
+ .leaflet-control-layers-toggle {
19
+ background-image: url({{public_url}}images/layers.png{{&key_query}});
20
+ width: 36px;
21
+ height: 36px;
22
+ }
23
+ .leaflet-retina .leaflet-control-layers-toggle {
24
+ background-image: url({{public_url}}images/layers-2x.png{{&key_query}});
25
+ background-size: 26px 26px;
26
+ }
27
+ .leaflet-default-icon-path { /* used only in path-guessing heuristic, see L.Icon.Default */
28
+ background-image: url({{public_url}}images/marker-icon.png{{&key_query}});
29
+ }
18
30
  </style>
19
31
  </head>
20
32
  <body>
@@ -26,11 +38,15 @@
26
38
  q.indexOf('vector') >= 0 ? 'vector' :
27
39
  (q.indexOf('raster') >= 0 ? 'raster' :
28
40
  (maplibregl.supported() ? 'vector' : 'raster'));
41
+
42
+ var keyMatch = location.search.match(/[\?\&]key=([^&]+)/i);
43
+ var keyParam = keyMatch ? '?key=' + keyMatch[1] : '';
44
+
29
45
  if (preference == 'vector') {
30
- maplibregl.setRTLTextPlugin('{{public_url}}mapbox-gl-rtl-text.js{{&key_query}}');
46
+ maplibregl.setRTLTextPlugin('{{public_url}}mapbox-gl-rtl-text.js' + keyParam);
31
47
  var map = new maplibregl.Map({
32
48
  container: 'map',
33
- style: '{{public_url}}styles/{{id}}/style.json{{&key_query}}',
49
+ style: '{{public_url}}styles/{{id}}/style.json' + keyParam,
34
50
  hash: true,
35
51
  maplibreLogo: true
36
52
  });
@@ -49,7 +65,7 @@
49
65
  new L.Control.Zoom({ position: 'topright' }).addTo(map);
50
66
 
51
67
  var tile_urls = [], tile_attribution, tile_minzoom, tile_maxzoom;
52
- var url = '{{public_url}}styles/{{id}}.json{{&key_query}}';
68
+ var url = '{{public_url}}styles/{{id}}.json' + keyParam;
53
69
  var req = new XMLHttpRequest();
54
70
  req.overrideMimeType("application/json");
55
71
  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