diff --git a/.dockerignore b/.dockerignore index 1661d17..9d5dc4d 100644 --- a/.dockerignore +++ b/.dockerignore @@ -3,5 +3,6 @@ !public !test !package.json +!mapbox-mbtiles-0.12.2.tgz !package-lock.json !docker-entrypoint.sh diff --git a/Dockerfile b/Dockerfile index dd43594..e99163d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -44,6 +44,7 @@ RUN mkdir -p /usr/src/app WORKDIR /usr/src/app +COPY mapbox-mbtiles-0.12.2.tgz /usr/src/app COPY package.json /usr/src/app COPY package-lock.json /usr/src/app diff --git a/src/serve_data.js b/src/serve_data.js index 0979dd0..52817c0 100644 --- a/src/serve_data.js +++ b/src/serve_data.js @@ -116,7 +116,7 @@ export const serve_data = { }, ); - app.get('/:id/:t(\\d+)/:z(\\ d+)/:x(\\d+)/:y(\\d+).:format([\\w.]+)', (req, res, next) => { + app.get('/:id/:t(\\d+)/:z(\\d+)/:x(\\d+)/:y(\\d+).:format([\\w.]+)', (req, res, next) => { const item = repo[req.params.id]; if (!item) { return res.sendStatus(404); @@ -131,7 +131,7 @@ export const serve_data = { format = 'pbf'; } if (format !== tileJSONFormat && - !(format === 'geojson' && tileJSONFormat === 'pbf')) { + !(format === 'geojson' && tileJSONFormat === 'pbf') && format !== 'png') { return res.status(404).send('Invalid format'); } if (z < item.tileJSON.minzoom || 0 || x < 0 || y < 0 || @@ -165,6 +165,8 @@ export const serve_data = { } if (format === 'pbf') { headers['Content-Type'] = 'application/x-protobuf'; + } else if (format === 'png') { + headers['Content-Type'] = 'image/png'; } else if (format === 'geojson') { headers['Content-Type'] = 'application/json';