mirror of
https://github.com/maptiler/tileserver-gl.git
synced 2024-11-04 02:17:42 +03:00
Fix incorrect TileSize in index.json and data.json data urls. Add TileSize option to index.json and rendered.json endpoints for rendered urls. (#1160)
* fix: tilesize should not be added to data endpoint * fix: make tilesize and option of addtilejson urls * docs: update tilesize info for index.json and rendered.json * fix: lint
This commit is contained in:
parent
c34c5786bd
commit
fe111ed18f
@ -102,7 +102,9 @@ Source data
|
||||
|
||||
TileJSON arrays
|
||||
===============
|
||||
Array of all TileJSONs is at ``/index.json`` (``/rendered.json``; ``/data.json``)
|
||||
Array of all TileJSONs is at ``[/{tileSize}]/index.json`` (``[/{tileSize}]/rendered.json``; ``/data.json``)
|
||||
|
||||
* The optional tile size ``/{tileSize}`` (ex. ``/256``, ``/512``). if omitted, tileSize defaults to 256.
|
||||
|
||||
List of available fonts
|
||||
=======================
|
||||
|
@ -354,9 +354,8 @@ function start(opts) {
|
||||
res.send(result);
|
||||
});
|
||||
|
||||
const addTileJSONs = (arr, req, type) => {
|
||||
const addTileJSONs = (arr, req, type, tileSize) => {
|
||||
for (const id of Object.keys(serving[type])) {
|
||||
const tileSize = 256;
|
||||
const info = clone(serving[type][id].tileJSON);
|
||||
let path = '';
|
||||
if (type === 'rendered') {
|
||||
@ -380,14 +379,23 @@ function start(opts) {
|
||||
return arr;
|
||||
};
|
||||
|
||||
app.get('/rendered.json', (req, res, next) => {
|
||||
res.send(addTileJSONs([], req, 'rendered'));
|
||||
app.get('/(:tileSize(256|512)/)?rendered.json', (req, res, next) => {
|
||||
const tileSize = parseInt(req.params.tileSize, 10) || 256;
|
||||
res.send(addTileJSONs([], req, 'rendered', tileSize));
|
||||
});
|
||||
app.get('/data.json', (req, res, next) => {
|
||||
res.send(addTileJSONs([], req, 'data'));
|
||||
res.send(addTileJSONs([], req, 'data', undefined));
|
||||
});
|
||||
app.get('/index.json', (req, res, next) => {
|
||||
res.send(addTileJSONs(addTileJSONs([], req, 'rendered'), req, 'data'));
|
||||
app.get('/(:tileSize(256|512)/)?index.json', (req, res, next) => {
|
||||
const tileSize = parseInt(req.params.tileSize, 10) || 256;
|
||||
res.send(
|
||||
addTileJSONs(
|
||||
addTileJSONs([], req, 'rendered', tileSize),
|
||||
req,
|
||||
'data',
|
||||
undefined,
|
||||
),
|
||||
);
|
||||
});
|
||||
|
||||
// ------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user