loaders.gl icon indicating copy to clipboard operation
loaders.gl copied to clipboard

ReferenceError: Response is not defined @loaders.gl/core/dist/es5/lib/api/select-loader.js:

Open sunny-livebird opened this issue 3 years ago • 4 comments

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)

sunny-livebird avatar Aug 17 '22 11:08 sunny-livebird

We will take a look

belom88 avatar Sep 08 '22 13:09 belom88

Are you on Node.js? You'll want to install @loaders.gl/polyfills

ibgreen avatar Sep 08 '22 21:09 ibgreen

We are using Electron.js

SunnyShah407 avatar Sep 09 '22 04:09 SunnyShah407

@sunny-livebird Hello! I did some research and this is what I found out:

  1. Yout should add egmFilePath option with correct path to the *.pgm file
  2. Also install @loaders.gl/polyfills and 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,
});

kirillovzah avatar Sep 23 '22 02:09 kirillovzah