From 57a0fca626a9a2bfd2ccfbafcfacbcf6811db1ab Mon Sep 17 00:00:00 2001 From: Andrew Calcutt Date: Mon, 22 Jan 2024 01:44:40 -0500 Subject: [PATCH] fix: don't use tilesize one data endpoint It doesn't do anything Signed-off-by: Andrew Calcutt --- docs/endpoints.rst | 5 ++--- public/templates/data.tmpl | 2 +- public/templates/index.tmpl | 2 +- src/serve_data.js | 4 ++-- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/docs/endpoints.rst b/docs/endpoints.rst index 37050dc..72dd068 100644 --- a/docs/endpoints.rst +++ b/docs/endpoints.rst @@ -92,14 +92,13 @@ Static images Source data =========== -* Source data are served at ``/data/{mbtiles}[/{tileSize}]/{z}/{x}/{y}.{format}`` +* Source data are served at ``/data/{id}/{z}/{x}/{y}.{format}`` * Format depends on the source file (usually ``png`` or ``pbf``) * ``geojson`` is also available (useful for inspecting the tiles) in case the original format is ``pbf`` - * The optional tile size ``/{tileSize}`` (ex. ``/256``, ``/512``) is ignored by the data endpoint, but is allowed for url consistency. - * TileJSON at ``/data/{mbtiles}.json`` + * TileJSON at ``/data/{id}.json`` TileJSON arrays =============== diff --git a/public/templates/data.tmpl b/public/templates/data.tmpl index c98435f..06d4938 100644 --- a/public/templates/data.tmpl +++ b/public/templates/data.tmpl @@ -98,7 +98,7 @@ new L.Control.Zoom({ position: 'topright' }).addTo(map); var tile_urls = [], tile_attribution, tile_minzoom, tile_maxzoom; - var url = '{{public_url}}data/256/{{id}}.json' + keyParam; + var url = '{{public_url}}data/{{id}}.json' + keyParam; var req = new XMLHttpRequest(); req.overrideMimeType("application/json"); req.open('GET', url, true); diff --git a/public/templates/index.tmpl b/public/templates/index.tmpl index 573dff3..0f0b6f0 100644 --- a/public/templates/index.tmpl +++ b/public/templates/index.tmpl @@ -81,7 +81,7 @@
identifier: {{@key}}{{#if formatted_filesize}} | size: {{formatted_filesize}}{{/if}}
type: {{#is_vector}}vector{{/is_vector}}{{^is_vector}}raster{{/is_vector}} data {{#if sourceType}} | ext: {{sourceType}}{{/if}}

- services: TileJSON + services: TileJSON {{#if xyz_link}} | XYZ diff --git a/src/serve_data.js b/src/serve_data.js index c3f4ce0..840da49 100644 --- a/src/serve_data.js +++ b/src/serve_data.js @@ -168,12 +168,12 @@ export const serve_data = { }, ); - app.get('/(:tileSize(256|512)/)?:id.json', (req, res, next) => { - const tileSize = parseInt(req.params.tileSize, 10) || 256; + app.get('/:id.json', (req, res, next) => { const item = repo[req.params.id]; if (!item) { return res.sendStatus(404); } + const tileSize = undefined; const info = clone(item.tileJSON); info.tiles = getTileUrls( req,