@loaders.gl/lerc
Version:
Framework-independent loader for LERC (Limited Error Raster Compression) files
8 lines (7 loc) • 2.67 kB
Source Map (JSON)
{
"version": 3,
"sources": ["../src/index.ts", "../src/lerc-loader.ts"],
"sourcesContent": ["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\n// LERC - Limited Error Raster Compression\nexport const LERC_ERROR = 'lerc module is not esbuild compatible';\nexport type {LERCData} from './lib/parsers/lerc/lerc-types';\nexport {LERCLoader} from './lerc-loader';\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';\nimport type {LERCData} from './lib/parsers/lerc/lerc-types';\nimport * as Lerc from 'lerc';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\n/** LERC loader options */\nexport type LERCLoaderOptions = LoaderOptions & {\n /** LERC loader options */\n lerc?: {\n /**\tThe number of bytes to skip in the input byte stream. A valid Lerc file is expected at that position. */\n inputOffset?: number;\n /**\tIt is recommended to use the returned mask instead of setting this value. */\n noDataValue?: number;\n /**\t(ndepth LERC2 only) If true, returned depth values are pixel-interleaved. */\n returnInterleaved?: boolean;\n };\n};\n\n/**\n * Loader for the LERC raster format\n */\nexport const LERCLoader = {\n dataType: null as unknown as LERCData,\n batchType: null as never,\n\n id: 'lerc',\n name: 'LERC',\n\n module: 'lerc',\n version: VERSION,\n worker: false,\n extensions: ['lrc', 'lerc', 'lerc2', 'lerc1'],\n mimeTypes: ['application/octet-stream'],\n // test: ?,\n options: {\n lerc: {}\n },\n parse: async (arrayBuffer: ArrayBuffer, options?: LERCLoaderOptions) =>\n parseLERC(arrayBuffer, options)\n} as const satisfies LoaderWithParser<LERCData, never, LERCLoaderOptions>;\n\nasync function parseLERC(arrayBuffer: ArrayBuffer, options?: LERCLoaderOptions): Promise<LERCData> {\n // Load the WASM library\n await Lerc.load();\n // Perform the decode\n const pixelBlock = Lerc.decode(arrayBuffer, options?.lerc);\n return pixelBlock;\n}\n"],
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;ACMA,WAAsB;AAItB,IAAM,UAAU,OAAoC,UAAe;AAkB5D,IAAM,aAAa;EACxB,UAAU;EACV,WAAW;EAEX,IAAI;EACJ,MAAM;EAEN,QAAQ;EACR,SAAS;EACT,QAAQ;EACR,YAAY,CAAC,OAAO,QAAQ,SAAS,OAAO;EAC5C,WAAW,CAAC,0BAA0B;;EAEtC,SAAS;IACP,MAAM,CAAA;;EAER,OAAO,OAAO,aAA0B,YACtC,UAAU,aAAa,OAAO;;AAGlC,eAAe,UAAU,aAA0B,SAA2B;AAE5E,QAAW,UAAI;AAEf,QAAM,aAAkB,YAAO,aAAa,mCAAS,IAAI;AACzD,SAAO;AACT;;;ADjDO,IAAM,aAAa;",
"names": []
}