ReferenceError: Response is not defined @loaders.gl/core/dist/es5/lib/api/select-loader.js:
HI I am trying to Convert from /to 3Dtiles and i3s SLPK .
module.exports = { convertFiles: async (url, outputPath) => { const converter = new I3SConverter(); const tilesetJson = await converter.convert({ inputUrl: url, outputPath: "data", slpk: true, tilesetName: "BatchedColors", }); }, };
But I am getting error
UnhandledPromiseRejectionWarning: ReferenceError: Response is not defined node_modules/@loaders.gl/core/dist/es5/lib/api/select-loader.js:185:23)
We will take a look
Are you on Node.js? You'll want to install @loaders.gl/polyfills
We are using Electron.js
@sunny-livebird Hello! I did some research and this is what I found out:
- Yout should add
egmFilePathoption with correct path to the*.pgmfile - Also install
@loaders.gl/polyfillsand import it
Some example of working code:
import "@loaders.gl/polyfills";
import { I3SConverter } from "@loaders.gl/tile-converter";
const TILESET_URL = "./tileset.json";
const PGM_FILE_PATH = "./egm2008-5.pgm";
const converter = new I3SConverter();
const tilesetJson = await converter.convert({
inputUrl: TILESET_URL,
outputPath: "data",
tilesetName: "BatchedColors",
slpk: true,
egmFilePath: PGM_FILE_PATH,
});