tileserver-gl-light 4.10.0 → 4.10.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/docs/endpoints.rst +3 -1
- package/package.json +1 -1
- package/src/server.js +15 -7
package/docs/endpoints.rst
CHANGED
|
@@ -102,7 +102,9 @@ Source data
|
|
|
102
102
|
|
|
103
103
|
TileJSON arrays
|
|
104
104
|
===============
|
|
105
|
-
Array of all TileJSONs is at
|
|
105
|
+
Array of all TileJSONs is at ``[/{tileSize}]/index.json`` (``[/{tileSize}]/rendered.json``; ``/data.json``)
|
|
106
|
+
|
|
107
|
+
* The optional tile size ``/{tileSize}`` (ex. ``/256``, ``/512``). if omitted, tileSize defaults to 256.
|
|
106
108
|
|
|
107
109
|
List of available fonts
|
|
108
110
|
=======================
|
package/package.json
CHANGED
package/src/server.js
CHANGED
|
@@ -354,9 +354,8 @@ function start(opts) {
|
|
|
354
354
|
res.send(result);
|
|
355
355
|
});
|
|
356
356
|
|
|
357
|
-
const addTileJSONs = (arr, req, type) => {
|
|
357
|
+
const addTileJSONs = (arr, req, type, tileSize) => {
|
|
358
358
|
for (const id of Object.keys(serving[type])) {
|
|
359
|
-
const tileSize = 256;
|
|
360
359
|
const info = clone(serving[type][id].tileJSON);
|
|
361
360
|
let path = '';
|
|
362
361
|
if (type === 'rendered') {
|
|
@@ -380,14 +379,23 @@ function start(opts) {
|
|
|
380
379
|
return arr;
|
|
381
380
|
};
|
|
382
381
|
|
|
383
|
-
app.get('/rendered.json', (req, res, next) => {
|
|
384
|
-
|
|
382
|
+
app.get('/(:tileSize(256|512)/)?rendered.json', (req, res, next) => {
|
|
383
|
+
const tileSize = parseInt(req.params.tileSize, 10) || 256;
|
|
384
|
+
res.send(addTileJSONs([], req, 'rendered', tileSize));
|
|
385
385
|
});
|
|
386
386
|
app.get('/data.json', (req, res, next) => {
|
|
387
|
-
res.send(addTileJSONs([], req, 'data'));
|
|
387
|
+
res.send(addTileJSONs([], req, 'data', undefined));
|
|
388
388
|
});
|
|
389
|
-
app.get('/index.json', (req, res, next) => {
|
|
390
|
-
|
|
389
|
+
app.get('/(:tileSize(256|512)/)?index.json', (req, res, next) => {
|
|
390
|
+
const tileSize = parseInt(req.params.tileSize, 10) || 256;
|
|
391
|
+
res.send(
|
|
392
|
+
addTileJSONs(
|
|
393
|
+
addTileJSONs([], req, 'rendered', tileSize),
|
|
394
|
+
req,
|
|
395
|
+
'data',
|
|
396
|
+
undefined,
|
|
397
|
+
),
|
|
398
|
+
);
|
|
391
399
|
});
|
|
392
400
|
|
|
393
401
|
// ------------------------------------
|