fix t-coord tiles processing

This commit is contained in:
Ivan Vazhenin
2023-10-08 12:04:07 +03:00
parent 84930b82ca
commit 61e830901b
3 changed files with 6 additions and 2 deletions

View File

@@ -3,5 +3,6 @@
!public
!test
!package.json
!mapbox-mbtiles-0.12.2.tgz
!package-lock.json
!docker-entrypoint.sh

View File

@@ -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

View File

@@ -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';