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