fix: resolves Unimplemented type: 3 error for geojson format

This commit is contained in:
RJ Johnston 2025-02-13 17:06:07 -05:00 committed by Andrew Calcutt
parent 6d1c617752
commit 5d3c5250ac

View file

@ -21,6 +21,7 @@ import { openMbTilesWrapper } from './mbtiles_wrapper.js';
import fs from 'node:fs';
import { fileURLToPath } from 'url';
import zlib from 'zlib';
const packageJson = JSON.parse(
fs.readFileSync(
path.dirname(fileURLToPath(import.meta.url)) + '/../package.json',
@ -113,12 +114,14 @@ export const serve_data = {
let headers = fetchTile.headers;
let isGzipped = data.slice(0, 2).indexOf(Buffer.from([0x1f, 0x8b])) === 0;
if (tileJSONFormat === 'pbf') {
if (options.dataDecoratorFunc) {
if (isGzipped) {
data = await gunzipP(data);
isGzipped = false;
}
delete headers['Content-Encoding'];
if (tileJSONFormat === 'pbf') {
if (options.dataDecoratorFunc) {
data = options.dataDecoratorFunc(
req.params.id,
'data',
@ -259,8 +262,8 @@ export const serve_data = {
let data = fetchTile.data;
var param = {
long: bbox[0].toFixed(7),
lat: bbox[1].toFixed(7),
long: bbox[0],
lat: bbox[1],
encoding,
format,
tile_size: TILE_SIZE,