UNPKG

@loaders.gl/i3s

Version:
29 lines (28 loc) 1.09 kB
// loaders.gl // SPDX-License-Identifier: MIT // Copyright vis.gl contributors import { DataViewFile } from '@loaders.gl/loader-utils'; import { parseSLPKArchive } from "./lib/parsers/parse-slpk/parse-slpk.js"; // __VERSION__ is injected by babel-plugin-version-inline // @ts-ignore TS2304: Cannot find name '__VERSION__'. const VERSION = typeof "4.3.2" !== 'undefined' ? "4.3.2" : 'latest'; /** * Loader for SLPK - Scene Layer Package (Archive I3S format) * @todo - this reloads the entire archive for every tile, should be optimized * @todo - this should be updated to use `parseFile` and ReadableFile */ export const SLPKLoader = { dataType: null, batchType: null, name: 'I3S SLPK (Scene Layer Package)', id: 'slpk', module: 'i3s', version: VERSION, mimeTypes: ['application/octet-stream'], extensions: ['slpk'], options: {}, parse: async (data, options = {}) => { const archive = await parseSLPKArchive(new DataViewFile(new DataView(data))); return archive.getFile(options.slpk?.path ?? '', options.slpk?.pathMode); } };