fix: resolves Unimplemented type: 3 error for geojson format
This commit is contained in:
parent
6d1c617752
commit
5d3c5250ac
1 changed files with 9 additions and 6 deletions
|
@ -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 (isGzipped) {
|
||||
data = await gunzipP(data);
|
||||
isGzipped = false;
|
||||
}
|
||||
delete headers['Content-Encoding'];
|
||||
|
||||
if (tileJSONFormat === 'pbf') {
|
||||
if (options.dataDecoratorFunc) {
|
||||
if (isGzipped) {
|
||||
data = await gunzipP(data);
|
||||
isGzipped = false;
|
||||
}
|
||||
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,
|
||||
|
|
Loading…
Reference in a new issue