@loaders.gl/raster 5.0.0-beta.10 → 5.0.0-beta.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/geotiff/advanced.cjs +3 -3
- package/dist/geotiff/geotiff-loader-types.js +1 -1
- package/dist/geotiff/geotiff-raster-loader-types.js +1 -1
- package/dist/geotiff/loaders.js +1 -1
- package/dist/geotiff/ometiff-loader.js +1 -1
- package/dist/index.cjs +5 -5
- package/dist/index.cjs.map +2 -2
- package/dist/lerc/lerc-loader-types.js +1 -1
- package/dist/quantized-mesh-worker.js +42 -103
- package/dist/terrain/index.cjs +6 -6
- package/dist/terrain/index.cjs.map +2 -2
- package/dist/terrain/lib/utils/version.js +1 -1
- package/dist/terrain/quantized-mesh-loader.js +3 -3
- package/dist/terrain/quantized-mesh-loader.js.map +1 -1
- package/dist/terrain/quantized-mesh-writer.d.ts +4 -4
- package/dist/terrain/quantized-mesh-writer.d.ts.map +1 -1
- package/dist/terrain/quantized-mesh-writer.js +3 -3
- package/dist/terrain/quantized-mesh-writer.js.map +1 -1
- package/dist/terrain/terrain-loader.js +3 -3
- package/dist/terrain/terrain-loader.js.map +1 -1
- package/dist/terrain-worker.js +44 -105
- package/package.json +5 -5
- package/src/terrain/quantized-mesh-loader.ts +3 -3
- package/src/terrain/quantized-mesh-writer.ts +8 -12
- package/src/terrain/terrain-loader.ts +3 -3
|
@@ -128,7 +128,7 @@ var OMETiffFormat = {
|
|
|
128
128
|
};
|
|
129
129
|
|
|
130
130
|
// dist/geotiff/geotiff-loader-types.js
|
|
131
|
-
var VERSION = true ? "5.0.0-beta.
|
|
131
|
+
var VERSION = true ? "5.0.0-beta.11" : "latest";
|
|
132
132
|
async function preload() {
|
|
133
133
|
const { GeoTIFFLoaderWithParser: GeoTIFFLoaderWithParser2 } = await import("@loaders.gl/raster/geotiff-loader");
|
|
134
134
|
return GeoTIFFLoaderWithParser2;
|
|
@@ -1644,7 +1644,7 @@ async function loadOmeTiff(tiff, firstImage) {
|
|
|
1644
1644
|
}
|
|
1645
1645
|
|
|
1646
1646
|
// dist/geotiff/ometiff-loader.js
|
|
1647
|
-
var VERSION2 = true ? "5.0.0-beta.
|
|
1647
|
+
var VERSION2 = true ? "5.0.0-beta.11" : "latest";
|
|
1648
1648
|
var OMETiffLoader = {
|
|
1649
1649
|
dataType: null,
|
|
1650
1650
|
batchType: null,
|
|
@@ -1881,7 +1881,7 @@ async function loadGeoTiff(source, opts = {}) {
|
|
|
1881
1881
|
}
|
|
1882
1882
|
|
|
1883
1883
|
// dist/geotiff/geotiff-raster-loader-types.js
|
|
1884
|
-
var VERSION3 = true ? "5.0.0-beta.
|
|
1884
|
+
var VERSION3 = true ? "5.0.0-beta.11" : "latest";
|
|
1885
1885
|
async function preload2() {
|
|
1886
1886
|
const { GeoTIFFRasterLoaderWithParser } = await import("@loaders.gl/raster/geotiff-raster-loader");
|
|
1887
1887
|
return GeoTIFFRasterLoaderWithParser;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { GeoTIFFFormat } from "./geotiff-format.js";
|
|
5
5
|
// __VERSION__ is injected by babel-plugin-version-inline
|
|
6
6
|
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
7
|
-
const VERSION = typeof "5.0.0-beta.
|
|
7
|
+
const VERSION = typeof "5.0.0-beta.11" !== 'undefined' ? "5.0.0-beta.11" : 'latest';
|
|
8
8
|
/** Preloads the parser-bearing GeoTIFF loader implementation. */
|
|
9
9
|
async function preload() {
|
|
10
10
|
const { GeoTIFFLoaderWithParser } = await import('@loaders.gl/raster/geotiff-loader');
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { GeoTIFFFormat } from "./geotiff-format.js";
|
|
5
5
|
// __VERSION__ is injected by babel-plugin-version-inline
|
|
6
6
|
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
7
|
-
const VERSION = typeof "5.0.0-beta.
|
|
7
|
+
const VERSION = typeof "5.0.0-beta.11" !== 'undefined' ? "5.0.0-beta.11" : 'latest';
|
|
8
8
|
/** Loads the optional numeric TIFF parser on first use by an asynchronous core API. */
|
|
9
9
|
async function preload() {
|
|
10
10
|
const { GeoTIFFRasterLoaderWithParser } = await import('@loaders.gl/raster/geotiff-raster-loader');
|
package/dist/geotiff/loaders.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { fromArrayBuffer } from 'geotiff';
|
|
5
5
|
// __VERSION__ is injected by babel-plugin-version-inline
|
|
6
6
|
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
7
|
-
const VERSION = typeof "5.0.0-beta.
|
|
7
|
+
const VERSION = typeof "5.0.0-beta.11" !== 'undefined' ? "5.0.0-beta.11" : 'latest';
|
|
8
8
|
/**
|
|
9
9
|
* Loads a GeoTIFF file containing a RGB image.
|
|
10
10
|
*/
|
|
@@ -8,7 +8,7 @@ import { ensureArray, getImageSize, intToRgba } from "./lib/utils/tiff-utils.js"
|
|
|
8
8
|
import { OMETiffFormat } from "./geotiff-format.js";
|
|
9
9
|
// __VERSION__ is injected by babel-plugin-version-inline
|
|
10
10
|
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
11
|
-
const VERSION = typeof "5.0.0-beta.
|
|
11
|
+
const VERSION = typeof "5.0.0-beta.11" !== 'undefined' ? "5.0.0-beta.11" : 'latest';
|
|
12
12
|
/**
|
|
13
13
|
* Source factory for non-geospatial OME-TIFF plane data.
|
|
14
14
|
*/
|
package/dist/index.cjs
CHANGED
|
@@ -65,7 +65,7 @@ var OMETiffFormat = {
|
|
|
65
65
|
};
|
|
66
66
|
|
|
67
67
|
// dist/geotiff/geotiff-loader-types.js
|
|
68
|
-
var VERSION = true ? "5.0.0-beta.
|
|
68
|
+
var VERSION = true ? "5.0.0-beta.11" : "latest";
|
|
69
69
|
async function preload() {
|
|
70
70
|
const { GeoTIFFLoaderWithParser } = await import("@loaders.gl/raster/geotiff-loader");
|
|
71
71
|
return GeoTIFFLoaderWithParser;
|
|
@@ -94,7 +94,7 @@ var GeoTIFFLoader = {
|
|
|
94
94
|
};
|
|
95
95
|
|
|
96
96
|
// dist/geotiff/geotiff-raster-loader-types.js
|
|
97
|
-
var VERSION2 = true ? "5.0.0-beta.
|
|
97
|
+
var VERSION2 = true ? "5.0.0-beta.11" : "latest";
|
|
98
98
|
async function preload2() {
|
|
99
99
|
const { GeoTIFFRasterLoaderWithParser } = await import("@loaders.gl/raster/geotiff-raster-loader");
|
|
100
100
|
return GeoTIFFRasterLoaderWithParser;
|
|
@@ -123,7 +123,7 @@ var LERCFormat = {
|
|
|
123
123
|
};
|
|
124
124
|
|
|
125
125
|
// dist/lerc/lerc-loader-types.js
|
|
126
|
-
var VERSION3 = true ? "5.0.0-beta.
|
|
126
|
+
var VERSION3 = true ? "5.0.0-beta.11" : "latest";
|
|
127
127
|
async function preload3() {
|
|
128
128
|
const { LERCLoaderWithParser } = await import("@loaders.gl/raster/lerc-loader");
|
|
129
129
|
return LERCLoaderWithParser;
|
|
@@ -147,7 +147,7 @@ var LERCLoader = {
|
|
|
147
147
|
};
|
|
148
148
|
|
|
149
149
|
// dist/terrain/lib/utils/version.js
|
|
150
|
-
var VERSION4 = true ? "5.0.0-beta.
|
|
150
|
+
var VERSION4 = true ? "5.0.0-beta.11" : "latest";
|
|
151
151
|
|
|
152
152
|
// dist/terrain/terrain-format.js
|
|
153
153
|
var TerrainFormat = {
|
|
@@ -270,7 +270,7 @@ function normalizeMeshArrowTable(data) {
|
|
|
270
270
|
if (!("attributes" in data)) {
|
|
271
271
|
return data;
|
|
272
272
|
}
|
|
273
|
-
return (0, import_schema_utils.
|
|
273
|
+
return (0, import_schema_utils.convertMeshToArrowTable)(data);
|
|
274
274
|
}
|
|
275
275
|
function getRequiredAttribute(mesh, attributeName) {
|
|
276
276
|
const attribute = mesh.attributes[attributeName];
|
package/dist/index.cjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.ts", "../src/geotiff/geotiff-format.ts", "../src/geotiff/geotiff-loader-types.ts", "../src/geotiff/geotiff-raster-loader-types.ts", "../src/lerc/lerc-format.ts", "../src/lerc/lerc-loader-types.ts", "../src/terrain/lib/utils/version.ts", "../src/terrain/terrain-format.ts", "../src/terrain/terrain-loader-types.ts", "../src/terrain/quantized-mesh-loader-types.ts", "../src/terrain/quantized-mesh-writer.ts", "../src/geotiff/ometiff-loader-types.ts"],
|
|
4
|
-
"sourcesContent": ["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nexport {GeoTIFFLoader} from './geotiff/geotiff-loader-types';\nexport type {GeoTIFFLoaderOptions} from './geotiff/geotiff-loader-types';\nexport {GeoTIFFRasterLoader} from './geotiff/geotiff-raster-loader-types';\nexport type {\n GeoTIFFRasterData,\n GeoTIFFRasterImage,\n GeoTIFFRasterBand,\n GeoTIFFRasterLoaderOptions\n} from './geotiff/geotiff-raster-types';\nexport {GeoTIFFFormat, OMETiffFormat} from './geotiff/geotiff-format';\nexport {LERCLoader} from './lerc/lerc-loader-types';\nexport type {LERCLoaderOptions} from './lerc/lerc-loader-types';\nexport {LERCFormat} from './lerc/lerc-format';\nexport type {LERCData} from './lerc/lib/parsers/lerc/lerc-types';\nexport {TerrainLoader} from './terrain/terrain-loader-types';\nexport type {TerrainLoaderOptions} from './terrain/terrain-loader-types';\nexport {QuantizedMeshLoader} from './terrain/quantized-mesh-loader-types';\nexport type {QuantizedMeshLoaderOptions} from './terrain/quantized-mesh-loader-types';\nexport {TerrainFormat, QuantizedMeshFormat} from './terrain/terrain-format';\nexport {QuantizedMeshWriter} from './terrain/quantized-mesh-writer';\nexport type {QuantizedMeshWriterOptions} from './terrain/quantized-mesh-writer';\nexport type {\n ElevationDecoder,\n TerrainHeightmap,\n TerrainHeightmapImage\n} from './terrain/lib/terrain-heightmap-types';\nexport type {\n TerrainRay,\n TerrainSurfaceHit,\n TerrainSurfaceBounds,\n TerrainSurface\n} from './terrain/lib/terrain-contracts';\n\nexport {OMETiffLoader} from './geotiff/ometiff-loader-types';\nexport type {GeoTIFFSourceLoaderOptions} from './geotiff/geotiff-source-loader';\nexport type {OMETiffLoaderOptions} from './geotiff/ometiff-loader';\nexport type {\n GetOMETiffParameters,\n OMETiffChannelMetadata,\n OMETiffLevelMetadata,\n OMETiffSourceLoaderMetadata\n} from './geotiff/ometiff-loader';\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {Format} from '@loaders.gl/core/loader-utils';\n\n/** GeoTIFF raster image format. */\nexport const GeoTIFFFormat = {\n id: 'geotiff',\n name: 'GeoTIFF',\n module: 'raster',\n encoding: 'image',\n format: 'geotiff',\n mimeTypes: ['image/tiff'],\n extensions: ['geotiff', 'tiff', 'geotif', 'tif']\n} as const satisfies Format;\n\n/** OME-TIFF raster image format. */\nexport const OMETiffFormat = {\n name: 'OME-TIFF',\n id: 'ometiff',\n module: 'raster',\n encoding: 'image',\n format: 'ome-tiff',\n extensions: ['ome.tif', 'ome.tiff'],\n mimeTypes: ['image/tiff', 'image/geotiff']\n} as const satisfies Format;\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {TypedArray, Loader, LoaderOptions} from '@loaders.gl/core/loader-utils';\nimport type {CRSIdentifier} from '@math.gl/geospatial/crs';\nimport type {GeoTIFFSourceLoaderOptions} from './geotiff-source-loader';\nimport {GeoTIFFFormat} from './geotiff-format';\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// Return type definition for GeoTIFF loader\ntype GeoTIFFData = {\n crs?: CRSIdentifier;\n bounds: number[];\n metadata: Record<string, unknown>;\n\n width: number;\n height: number;\n data: TypedArray;\n};\n\n/** GeoTIFF load options */\nexport type GeoTIFFLoaderOptions = LoaderOptions & {\n geotiff?: GeoTIFFSourceLoaderOptions['geotiff'] & {enableAlpha?: boolean};\n};\n\n/** Preloads the parser-bearing GeoTIFF loader implementation. */\nasync function preload() {\n const {GeoTIFFLoaderWithParser} = await import('@loaders.gl/raster/geotiff-loader');\n return GeoTIFFLoaderWithParser;\n}\n\n/** Metadata-only GeoTIFF loader. */\nexport const GeoTIFFLoader = {\n /** Matches input for source selection. */\n testURL: (url: string): boolean => {\n if (/\\.ome\\.tiff?(?:$|[?#])/i.test(url)) {\n return false;\n }\n return /\\.(?:geotiff?|tiff?)(?:$|[?#])/i.test(url);\n },\n fromUrl: true,\n fromBlob: true,\n type: 'geotiff',\n dataType: null as unknown as GeoTIFFData,\n batchType: null as never,\n\n ...GeoTIFFFormat,\n version: VERSION,\n options: {\n geotiff: {\n enableAlpha: true\n }\n },\n preload\n} as const satisfies Loader<GeoTIFFData, never, GeoTIFFLoaderOptions>;\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {Loader} from '@loaders.gl/core/loader-utils';\nimport {GeoTIFFFormat} from './geotiff-format';\nimport type {GeoTIFFRasterData, GeoTIFFRasterLoaderOptions} from './geotiff-raster-types';\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/** Loads the optional numeric TIFF parser on first use by an asynchronous core API. */\nasync function preload() {\n const {GeoTIFFRasterLoaderWithParser} = await import('@loaders.gl/raster/geotiff-raster-loader');\n return GeoTIFFRasterLoaderWithParser;\n}\n\n/** Metadata-only loader for original numeric TIFF bands and geospatial metadata. */\nexport const GeoTIFFRasterLoader = {\n ...GeoTIFFFormat,\n id: 'geotiff-raster',\n name: 'GeoTIFF Raster',\n version: VERSION,\n dataType: null as unknown as GeoTIFFRasterData,\n batchType: null as never,\n options: {geotiff: {}},\n preload\n} as const satisfies Loader<GeoTIFFRasterData, never, GeoTIFFRasterLoaderOptions>;\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {Format} from '@loaders.gl/core/loader-utils';\n\nexport const LERCFormat = {\n name: 'LERC',\n id: 'lerc',\n module: 'raster',\n encoding: 'binary',\n format: 'lerc',\n extensions: ['lrc', 'lerc', 'lerc2', 'lerc1'],\n mimeTypes: ['application/octet-stream'],\n binary: true\n} as const satisfies Format;\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {Loader, LoaderOptions} from '@loaders.gl/core/loader-utils';\nimport type {LERCData} from './lib/parsers/lerc/lerc-types';\n\nimport {LERCFormat} from './lerc-format';\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/** Preloads the parser-bearing LERC loader implementation. */\nasync function preload() {\n const {LERCLoaderWithParser} = await import('@loaders.gl/raster/lerc-loader');\n return LERCLoaderWithParser;\n}\n\n/** Metadata-only loader for the LERC raster format. */\nexport const LERCLoader = {\n ...LERCFormat,\n dataType: null as unknown as LERCData,\n batchType: null as never,\n\n id: 'lerc',\n name: 'LERC',\n\n module: 'raster',\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 preload\n} as const satisfies Loader<LERCData, never, LERCLoaderOptions>;\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\n// Version constant cannot be imported, it needs to correspond to the build version of **this** module.\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nexport const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {Format} from '@loaders.gl/core/loader-utils';\n\n/** Image-encoded terrain format. */\nexport const TerrainFormat = {\n name: 'Terrain',\n id: 'terrain',\n module: 'raster',\n encoding: 'image',\n format: 'terrain',\n extensions: ['png', 'pngraw', 'jpg', 'jpeg', 'gif', 'webp', 'bmp'],\n mimeTypes: ['image/png', 'image/jpeg', 'image/gif', 'image/webp', 'image/bmp']\n} as const satisfies Format;\n\n/** Quantized mesh terrain format. */\nexport const QuantizedMeshFormat = {\n name: 'Quantized Mesh',\n id: 'quantized-mesh',\n module: 'raster',\n encoding: 'binary',\n format: 'quantized-mesh',\n extensions: ['terrain'],\n mimeTypes: ['application/vnd.quantized-mesh'],\n binary: true\n} as const satisfies Format;\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {Loader} from '@loaders.gl/core/loader-utils';\nimport type {Table} from 'apache-arrow';\nimport type {Mesh} from '@loaders.gl/core/schema';\nimport type {ImageLoaderOptions} from '@loaders.gl/images';\nimport {VERSION} from './lib/utils/version';\n\nimport type {TerrainOptions} from './lib/parse-terrain';\nimport {TerrainFormat} from './terrain-format';\n\n/** TerrainLoader options */\nexport type TerrainLoaderOptions = ImageLoaderOptions & {\n /** TerrainLoader options */\n terrain?: TerrainOptions & {\n /** Selects mesh output or Apache Arrow output. */\n shape?: 'mesh' | 'arrow';\n /** Override the URL to the worker bundle (by default loads from unpkg.com) */\n workerUrl?: string;\n };\n};\n\n/**\n * Worker loader for image encoded terrain\n */\nexport const TerrainLoader = {\n defaultShape: 'arrow',\n supportsNativeArrow: true,\n dataType: null as unknown as Mesh | Table,\n batchType: null as never,\n\n ...TerrainFormat,\n version: VERSION,\n worker: true,\n /** Loads the parser-bearing terrain loader implementation. */\n preload: async () => (await import('@loaders.gl/raster/terrain-loader')).TerrainLoaderWithParser,\n options: {\n terrain: {\n tesselator: 'auto',\n shape: 'arrow',\n bounds: undefined!,\n meshMaxError: 10,\n elevationDecoder: {\n rScaler: 1,\n gScaler: 0,\n bScaler: 0,\n offset: 0\n },\n skirtHeight: undefined\n }\n }\n} as const satisfies Loader<Mesh | Table, never, TerrainLoaderOptions>;\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {Loader, LoaderOptions} from '@loaders.gl/core/loader-utils';\nimport type {Table} from 'apache-arrow';\nimport type {Mesh} from '@loaders.gl/core/schema';\nimport {VERSION} from './lib/utils/version';\nimport {QuantizedMeshFormat} from './terrain-format';\n\n/** QuantizedMeshLoader options */\nexport type QuantizedMeshLoaderOptions = LoaderOptions & {\n /** QuantizedMeshLoader options */\n 'quantized-mesh'?: {\n /** Selects mesh output or Apache Arrow output. */\n shape?: 'mesh' | 'arrow';\n bounds?: [number, number, number, number];\n skirtHeight?: number | null;\n /** Override the URL to the worker bundle (by default loads from unpkg.com) */\n workerUrl?: string;\n };\n};\n\n/**\n * Worker loader for quantized meshes\n */\nexport const QuantizedMeshLoader = {\n defaultShape: 'arrow',\n supportsNativeArrow: true,\n dataType: null as unknown as Mesh | Table,\n batchType: null as never,\n\n ...QuantizedMeshFormat,\n version: VERSION,\n worker: true,\n /** Loads the parser-bearing quantized mesh loader implementation. */\n preload: async () =>\n (await import('@loaders.gl/raster/quantized-mesh-loader')).QuantizedMeshLoaderWithParser,\n options: {\n 'quantized-mesh': {\n shape: 'arrow',\n bounds: [0, 0, 1, 1],\n skirtHeight: null\n }\n }\n} as const satisfies Loader<Mesh | Table, never, QuantizedMeshLoaderOptions>;\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {Table} from 'apache-arrow';\nimport type {WriterOptions, WriterWithEncoder} from '@loaders.gl/core/loader-utils';\nimport type {Mesh, MeshArrowTable, MeshAttribute} from '@loaders.gl/core/schema';\nimport {convertMeshToArrowTableWrapper, convertTableToMesh} from '@loaders.gl/core/schema-utils';\nimport {VERSION} from './lib/utils/version';\nimport {QuantizedMeshFormat} from './terrain-format';\n\nconst QUANTIZED_MESH_HEADER_LENGTH = 88;\nconst QUANTIZED_COORDINATE_RANGE = 32767;\nconst EMPTY_EDGE_INDICES_LENGTH = Uint32Array.BYTES_PER_ELEMENT * 4;\n\n/** Options for `QuantizedMeshWriter`. */\nexport type QuantizedMeshWriterOptions = WriterOptions & {\n /** Quantized mesh-specific writer options. */\n 'quantized-mesh'?: {\n /** Bounds used to map x/y positions to quantized u/v coordinates. */\n bounds?: [number, number, number, number];\n };\n};\n\n/**\n * Writer for the quantized mesh terrain format.\n */\nexport const QuantizedMeshWriter = {\n ...QuantizedMeshFormat,\n version: VERSION,\n dataType: null as unknown as Mesh | MeshArrowTable | Table,\n batchType: null as never,\n options: {\n 'quantized-mesh': {}\n },\n encode: async (data, options) => encodeQuantizedMeshSync(data, options),\n encodeSync: encodeQuantizedMeshSync\n} as const satisfies WriterWithEncoder<\n Mesh | MeshArrowTable | Table,\n never,\n QuantizedMeshWriterOptions\n>;\n\n/** Encode mesh category data as quantized mesh terrain bytes. */\nfunction encodeQuantizedMeshSync(\n data: Mesh | MeshArrowTable | Table,\n options: QuantizedMeshWriterOptions = {}\n): ArrayBuffer {\n const mesh = convertTableToMesh(normalizeMeshArrowTable(data));\n const positionAttribute = getRequiredAttribute(mesh, 'POSITION');\n const vertexCount = positionAttribute.value.length / positionAttribute.size;\n const boundingBox = getBoundingBox(positionAttribute, vertexCount);\n const bounds = options['quantized-mesh']?.bounds || [\n boundingBox[0][0],\n boundingBox[0][1],\n boundingBox[1][0],\n boundingBox[1][1]\n ];\n const triangleIndices = getTriangleIndices(mesh, vertexCount);\n const highWatermarkMesh = reorderMeshForHighWatermark(triangleIndices, vertexCount);\n const bytesPerIndex =\n vertexCount > 65536 ? Uint32Array.BYTES_PER_ELEMENT : Uint16Array.BYTES_PER_ELEMENT;\n const vertexDataLength =\n Uint32Array.BYTES_PER_ELEMENT + vertexCount * 3 * Uint16Array.BYTES_PER_ELEMENT;\n const triangleDataOffset = getAlignedOffset(\n QUANTIZED_MESH_HEADER_LENGTH + vertexDataLength,\n bytesPerIndex\n );\n const triangleDataLength = Uint32Array.BYTES_PER_ELEMENT + triangleIndices.length * bytesPerIndex;\n const arrayBuffer = new ArrayBuffer(\n triangleDataOffset + triangleDataLength + EMPTY_EDGE_INDICES_LENGTH\n );\n const dataView = new DataView(arrayBuffer);\n\n writeHeader(dataView, boundingBox);\n dataView.setUint32(QUANTIZED_MESH_HEADER_LENGTH, vertexCount, true);\n writeVertexData(dataView, QUANTIZED_MESH_HEADER_LENGTH + Uint32Array.BYTES_PER_ELEMENT, {\n positionAttribute,\n vertexCount,\n boundingBox,\n bounds,\n sourceVertexIndices: highWatermarkMesh.sourceVertexIndices\n });\n writeTriangleIndices(\n dataView,\n triangleDataOffset,\n highWatermarkMesh.triangleIndices,\n bytesPerIndex\n );\n writeEmptyEdgeIndices(dataView, triangleDataOffset + triangleDataLength);\n\n return arrayBuffer;\n}\n\n/** Return mesh data as a MeshArrowTable, converting plain Mesh data first. */\nfunction normalizeMeshArrowTable(data: Mesh | MeshArrowTable | Table): MeshArrowTable | Table {\n if (!('attributes' in data)) {\n return data;\n }\n return convertMeshToArrowTableWrapper(data as Mesh);\n}\n\n/** Return a required mesh attribute or throw a format-specific error. */\nfunction getRequiredAttribute(mesh: Mesh, attributeName: string): MeshAttribute {\n const attribute = mesh.attributes[attributeName];\n if (!attribute) {\n throw new Error(`QuantizedMeshWriter: ${attributeName} attribute is required`);\n }\n return attribute;\n}\n\n/** Write the fixed-length quantized mesh header. */\nfunction writeHeader(\n dataView: DataView,\n boundingBox: [[number, number, number], [number, number, number]]\n): void {\n const center = getCenter(boundingBox);\n const radius = getRadius(boundingBox, center);\n let byteOffset = 0;\n\n for (const value of center) {\n dataView.setFloat64(byteOffset, value, true);\n byteOffset += Float64Array.BYTES_PER_ELEMENT;\n }\n\n dataView.setFloat32(byteOffset, boundingBox[0][2], true);\n byteOffset += Float32Array.BYTES_PER_ELEMENT;\n dataView.setFloat32(byteOffset, boundingBox[1][2], true);\n byteOffset += Float32Array.BYTES_PER_ELEMENT;\n\n for (const value of center) {\n dataView.setFloat64(byteOffset, value, true);\n byteOffset += Float64Array.BYTES_PER_ELEMENT;\n }\n dataView.setFloat64(byteOffset, radius, true);\n byteOffset += Float64Array.BYTES_PER_ELEMENT;\n\n dataView.setFloat64(byteOffset, 0, true);\n dataView.setFloat64(byteOffset + 8, 0, true);\n dataView.setFloat64(byteOffset + 16, 0, true);\n}\n\n/** Write delta and zig-zag encoded u, v, and height vertex arrays. */\nfunction writeVertexData(\n dataView: DataView,\n byteOffset: number,\n parameters: {\n positionAttribute: MeshAttribute;\n vertexCount: number;\n boundingBox: [[number, number, number], [number, number, number]];\n bounds: [number, number, number, number];\n sourceVertexIndices: number[];\n }\n): void {\n const quantizedCoordinates = getQuantizedCoordinates(parameters);\n const arrayByteLength = parameters.vertexCount * Uint16Array.BYTES_PER_ELEMENT;\n\n writeDeltaEncodedArray(dataView, byteOffset, quantizedCoordinates.u);\n writeDeltaEncodedArray(dataView, byteOffset + arrayByteLength, quantizedCoordinates.v);\n writeDeltaEncodedArray(dataView, byteOffset + arrayByteLength * 2, quantizedCoordinates.height);\n}\n\n/** Return quantized u, v, and height arrays from positions. */\nfunction getQuantizedCoordinates(parameters: {\n positionAttribute: MeshAttribute;\n vertexCount: number;\n boundingBox: [[number, number, number], [number, number, number]];\n bounds: [number, number, number, number];\n sourceVertexIndices: number[];\n}): {u: Uint16Array; v: Uint16Array; height: Uint16Array} {\n const [minimumX, minimumY, maximumX, maximumY] = parameters.bounds;\n const heightMinimum = parameters.boundingBox[0][2];\n const heightMaximum = parameters.boundingBox[1][2];\n const u = new Uint16Array(parameters.vertexCount);\n const v = new Uint16Array(parameters.vertexCount);\n const height = new Uint16Array(parameters.vertexCount);\n\n for (let vertexIndex = 0; vertexIndex < parameters.vertexCount; vertexIndex++) {\n const sourceVertexIndex = parameters.sourceVertexIndices[vertexIndex];\n u[vertexIndex] = quantize(\n getComponent(parameters.positionAttribute, sourceVertexIndex, 0),\n minimumX,\n maximumX\n );\n v[vertexIndex] = quantize(\n getComponent(parameters.positionAttribute, sourceVertexIndex, 1),\n minimumY,\n maximumY\n );\n height[vertexIndex] = quantize(\n getComponent(parameters.positionAttribute, sourceVertexIndex, 2),\n heightMinimum,\n heightMaximum\n );\n }\n\n return {u, v, height};\n}\n\n/** Write a delta and zig-zag encoded Uint16 array. */\nfunction writeDeltaEncodedArray(dataView: DataView, byteOffset: number, values: Uint16Array): void {\n let previousValue = 0;\n for (let valueIndex = 0; valueIndex < values.length; valueIndex++) {\n const value = values[valueIndex];\n const delta = value - previousValue;\n dataView.setUint16(\n byteOffset + valueIndex * Uint16Array.BYTES_PER_ELEMENT,\n encodeZigZag(delta),\n true\n );\n previousValue = value;\n }\n}\n\n/** Write high-watermark encoded triangle indices. */\nfunction writeTriangleIndices(\n dataView: DataView,\n byteOffset: number,\n triangleIndices: number[],\n bytesPerIndex: number\n): void {\n dataView.setUint32(byteOffset, triangleIndices.length / 3, true);\n let highestIndex = 0;\n let indexByteOffset = byteOffset + Uint32Array.BYTES_PER_ELEMENT;\n\n for (const triangleIndex of triangleIndices) {\n const code = highestIndex - triangleIndex;\n if (code < 0) {\n throw new Error('QuantizedMeshWriter: triangle indices must be high-watermark encodable');\n }\n\n if (bytesPerIndex === Uint16Array.BYTES_PER_ELEMENT) {\n dataView.setUint16(indexByteOffset, code, true);\n } else {\n dataView.setUint32(indexByteOffset, code, true);\n }\n\n if (code === 0) {\n highestIndex++;\n }\n indexByteOffset += bytesPerIndex;\n }\n}\n\n/** Write empty west, south, east, and north edge-index lists. */\nfunction writeEmptyEdgeIndices(dataView: DataView, byteOffset: number): void {\n dataView.setUint32(byteOffset, 0, true);\n dataView.setUint32(byteOffset + 4, 0, true);\n dataView.setUint32(byteOffset + 8, 0, true);\n dataView.setUint32(byteOffset + 12, 0, true);\n}\n\n/** Return triangle indices for indexed or sequential triangle-list meshes. */\nfunction getTriangleIndices(mesh: Mesh, vertexCount: number): number[] {\n if (mesh.indices?.value?.length) {\n return Array.from(mesh.indices.value);\n }\n\n if (mesh.mode !== 4 && mesh.topology !== 'triangle-list') {\n throw new Error('QuantizedMeshWriter: triangle-list mesh data is required');\n }\n\n const triangleIndices: number[] = [];\n for (let vertexIndex = 0; vertexIndex + 2 < vertexCount; vertexIndex += 3) {\n triangleIndices.push(vertexIndex, vertexIndex + 1, vertexIndex + 2);\n }\n return triangleIndices;\n}\n\n/** Return vertices and indices reordered into first-reference order for high-watermark encoding. */\nfunction reorderMeshForHighWatermark(\n triangleIndices: number[],\n vertexCount: number\n): {triangleIndices: number[]; sourceVertexIndices: number[]} {\n const remappedVertexIndices = new Map<number, number>();\n const sourceVertexIndices: number[] = [];\n const remappedTriangleIndices = triangleIndices.map(triangleIndex => {\n if (!Number.isInteger(triangleIndex) || triangleIndex < 0 || triangleIndex >= vertexCount) {\n throw new Error('QuantizedMeshWriter: triangle index is out of range');\n }\n\n const existingIndex = remappedVertexIndices.get(triangleIndex);\n if (existingIndex !== undefined) {\n return existingIndex;\n }\n\n const nextIndex = sourceVertexIndices.length;\n remappedVertexIndices.set(triangleIndex, nextIndex);\n sourceVertexIndices.push(triangleIndex);\n return nextIndex;\n });\n\n for (let vertexIndex = 0; vertexIndex < vertexCount; vertexIndex++) {\n if (!remappedVertexIndices.has(vertexIndex)) {\n sourceVertexIndices.push(vertexIndex);\n }\n }\n\n return {triangleIndices: remappedTriangleIndices, sourceVertexIndices};\n}\n\n/** Return an aligned byte offset. */\nfunction getAlignedOffset(byteOffset: number, byteAlignment: number): number {\n const remainder = byteOffset % byteAlignment;\n return remainder === 0 ? byteOffset : byteOffset + byteAlignment - remainder;\n}\n\n/** Return a single attribute component with 0 as the missing component fallback. */\nfunction getComponent(\n attribute: MeshAttribute,\n vertexIndex: number,\n componentIndex: number\n): number {\n return attribute.value[vertexIndex * attribute.size + componentIndex] || 0;\n}\n\n/** Compute a bounding box from position data. */\nfunction getBoundingBox(\n positionAttribute: MeshAttribute,\n vertexCount: number\n): [[number, number, number], [number, number, number]] {\n const minimum: [number, number, number] = [\n Number.POSITIVE_INFINITY,\n Number.POSITIVE_INFINITY,\n Number.POSITIVE_INFINITY\n ];\n const maximum: [number, number, number] = [\n Number.NEGATIVE_INFINITY,\n Number.NEGATIVE_INFINITY,\n Number.NEGATIVE_INFINITY\n ];\n\n for (let vertexIndex = 0; vertexIndex < vertexCount; vertexIndex++) {\n for (let componentIndex = 0; componentIndex < 3; componentIndex++) {\n const value = getComponent(positionAttribute, vertexIndex, componentIndex);\n minimum[componentIndex] = Math.min(minimum[componentIndex], value);\n maximum[componentIndex] = Math.max(maximum[componentIndex], value);\n }\n }\n\n return [minimum, maximum];\n}\n\n/** Return the center of a bounding box. */\nfunction getCenter(\n boundingBox: [[number, number, number], [number, number, number]]\n): [number, number, number] {\n return [\n (boundingBox[0][0] + boundingBox[1][0]) / 2,\n (boundingBox[0][1] + boundingBox[1][1]) / 2,\n (boundingBox[0][2] + boundingBox[1][2]) / 2\n ];\n}\n\n/** Return a bounding sphere radius that contains the bounding box. */\nfunction getRadius(\n boundingBox: [[number, number, number], [number, number, number]],\n center: [number, number, number]\n): number {\n const xDistance = Math.max(\n Math.abs(boundingBox[0][0] - center[0]),\n Math.abs(boundingBox[1][0] - center[0])\n );\n const yDistance = Math.max(\n Math.abs(boundingBox[0][1] - center[1]),\n Math.abs(boundingBox[1][1] - center[1])\n );\n const zDistance = Math.max(\n Math.abs(boundingBox[0][2] - center[2]),\n Math.abs(boundingBox[1][2] - center[2])\n );\n return Math.hypot(xDistance, yDistance, zDistance);\n}\n\n/** Quantize a value into the terrain coordinate range. */\nfunction quantize(value: number, minimum: number, maximum: number): number {\n const range = maximum - minimum || 1;\n const quantizedValue = Math.round(((value - minimum) / range) * QUANTIZED_COORDINATE_RANGE);\n return Math.max(0, Math.min(QUANTIZED_COORDINATE_RANGE, quantizedValue));\n}\n\n/** Zig-zag encode a signed delta. */\nfunction encodeZigZag(value: number): number {\n return (value << 1) ^ (value >> 31);\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {SourceLoader} from '@loaders.gl/core/loader-utils';\nimport type {OMETiffImageSource, OMETiffLoaderOptions} from './ometiff-loader';\nimport {OMETiffFormat} from './geotiff-format';\nimport {GeoTIFFLoader} from './geotiff-loader-types';\n\n/** Metadata-only OMETiff source loader. */\nexport const OMETiffLoader = {\n dataType: null as unknown as OMETiffImageSource,\n batchType: null as never,\n ...OMETiffFormat,\n name: 'OMETiffLoader',\n version: GeoTIFFLoader.version,\n type: 'ometiff',\n fromUrl: true,\n fromBlob: true,\n\n options: {\n ometiff: {\n headers: undefined!,\n interleaved: false,\n defaultChannels: undefined!\n }\n },\n\n defaultOptions: {\n ometiff: {\n headers: undefined!,\n interleaved: false,\n defaultChannels: undefined!\n }\n },\n\n testURL: (url: string): boolean => /\\.ome\\.tiff?(?:$|[?#])/i.test(url),\n /** Loads the implementation for asynchronous source construction. */\n preload: async () => (await import('@loaders.gl/raster/ometiff-loader')).OMETiffLoader,\n /** Synchronous construction requires the source implementation subpath. */\n createDataSourceSync(_data: string | Blob, _options: OMETiffLoaderOptions): OMETiffImageSource {\n throw new Error(\n 'OMETiffLoader requires async createDataSource() or its source implementation subpath'\n );\n }\n} as const satisfies SourceLoader<OMETiffImageSource>;\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;ACOO,IAAM,gBAAgB;EAC3B,IAAI;EACJ,MAAM;EACN,QAAQ;EACR,U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AAI;EACJ,MAAM;EAEN,QAAQ;EACR,SAASD;EACT,QAAQ;EACR,YAAY,CAAC,OAAO,QAAQ,SAAS,OAAO;EAC5C,WAAW,CAAC,0BAA0B;;EAEtC,SAAS;IACP,MAAM,CAAA;;EAER,SAAAC;;;;AC1CK,IAAMC,WAAU,OAAoC,kBAAe;;;ACAnE,IAAM,gBAAgB;EAC3B,MAAM;EACN,IAAI;EACJ,QAAQ;EACR,UAAU;EACV,QAAQ;EACR,YAAY,CAAC,OAAO,UAAU,OAAO,QAAQ,OAAO,QAAQ,KAAK;EACjE,WAAW,CAAC,aAAa,cAAc,aAAa,cAAc,WAAW;;AAIxE,IAAM,sBAAsB;EACjC,MAAM;EACN,IAAI;EACJ,QAAQ;EACR,UAAU;EACV,QAAQ;EACR,YAAY,CAAC,SAAS;EACtB,WAAW,CAAC,gCAAgC;EAC5C,QAAQ;;;;ACCH,IAAM,gBAAgB;EAC3B,cAAc;EACd,qBAAqB;EACrB,UAAU;EACV,WAAW;EAEX,GAAG;EACH,SAASC;EACT,QAAQ;;EAER,SAAS,aAAa,MAAM,OAAO,mCAAmC,GAAG;EACzE,SAAS;IACP,SAAS;MACP,YAAY;MACZ,OAAO;MACP,QAAQ;MACR,cAAc;MACd,kBAAkB;QAChB,SAAS;QACT,SAAS;QACT,SAAS;QACT,QAAQ;;MAEV,aAAa;;;;;;ACxBZ,IAAM,sBAAsB;EACjC,cAAc;EACd,qBAAqB;EACrB,UAAU;EACV,WAAW;EAEX,GAAG;EACH,SAASC;EACT,QAAQ;;EAER,SAAS,aACN,MAAM,OAAO,0CAA0C,GAAG;EAC7D,SAAS;IACP,kBAAkB;MAChB,OAAO;MACP,QAAQ,CAAC,GAAG,GAAG,GAAG,CAAC;MACnB,aAAa;;;;;;ACnCnB,
|
|
4
|
+
"sourcesContent": ["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nexport {GeoTIFFLoader} from './geotiff/geotiff-loader-types';\nexport type {GeoTIFFLoaderOptions} from './geotiff/geotiff-loader-types';\nexport {GeoTIFFRasterLoader} from './geotiff/geotiff-raster-loader-types';\nexport type {\n GeoTIFFRasterData,\n GeoTIFFRasterImage,\n GeoTIFFRasterBand,\n GeoTIFFRasterLoaderOptions\n} from './geotiff/geotiff-raster-types';\nexport {GeoTIFFFormat, OMETiffFormat} from './geotiff/geotiff-format';\nexport {LERCLoader} from './lerc/lerc-loader-types';\nexport type {LERCLoaderOptions} from './lerc/lerc-loader-types';\nexport {LERCFormat} from './lerc/lerc-format';\nexport type {LERCData} from './lerc/lib/parsers/lerc/lerc-types';\nexport {TerrainLoader} from './terrain/terrain-loader-types';\nexport type {TerrainLoaderOptions} from './terrain/terrain-loader-types';\nexport {QuantizedMeshLoader} from './terrain/quantized-mesh-loader-types';\nexport type {QuantizedMeshLoaderOptions} from './terrain/quantized-mesh-loader-types';\nexport {TerrainFormat, QuantizedMeshFormat} from './terrain/terrain-format';\nexport {QuantizedMeshWriter} from './terrain/quantized-mesh-writer';\nexport type {QuantizedMeshWriterOptions} from './terrain/quantized-mesh-writer';\nexport type {\n ElevationDecoder,\n TerrainHeightmap,\n TerrainHeightmapImage\n} from './terrain/lib/terrain-heightmap-types';\nexport type {\n TerrainRay,\n TerrainSurfaceHit,\n TerrainSurfaceBounds,\n TerrainSurface\n} from './terrain/lib/terrain-contracts';\n\nexport {OMETiffLoader} from './geotiff/ometiff-loader-types';\nexport type {GeoTIFFSourceLoaderOptions} from './geotiff/geotiff-source-loader';\nexport type {OMETiffLoaderOptions} from './geotiff/ometiff-loader';\nexport type {\n GetOMETiffParameters,\n OMETiffChannelMetadata,\n OMETiffLevelMetadata,\n OMETiffSourceLoaderMetadata\n} from './geotiff/ometiff-loader';\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {Format} from '@loaders.gl/core/loader-utils';\n\n/** GeoTIFF raster image format. */\nexport const GeoTIFFFormat = {\n id: 'geotiff',\n name: 'GeoTIFF',\n module: 'raster',\n encoding: 'image',\n format: 'geotiff',\n mimeTypes: ['image/tiff'],\n extensions: ['geotiff', 'tiff', 'geotif', 'tif']\n} as const satisfies Format;\n\n/** OME-TIFF raster image format. */\nexport const OMETiffFormat = {\n name: 'OME-TIFF',\n id: 'ometiff',\n module: 'raster',\n encoding: 'image',\n format: 'ome-tiff',\n extensions: ['ome.tif', 'ome.tiff'],\n mimeTypes: ['image/tiff', 'image/geotiff']\n} as const satisfies Format;\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {TypedArray, Loader, LoaderOptions} from '@loaders.gl/core/loader-utils';\nimport type {CRSIdentifier} from '@math.gl/geospatial/crs';\nimport type {GeoTIFFSourceLoaderOptions} from './geotiff-source-loader';\nimport {GeoTIFFFormat} from './geotiff-format';\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// Return type definition for GeoTIFF loader\ntype GeoTIFFData = {\n crs?: CRSIdentifier;\n bounds: number[];\n metadata: Record<string, unknown>;\n\n width: number;\n height: number;\n data: TypedArray;\n};\n\n/** GeoTIFF load options */\nexport type GeoTIFFLoaderOptions = LoaderOptions & {\n geotiff?: GeoTIFFSourceLoaderOptions['geotiff'] & {enableAlpha?: boolean};\n};\n\n/** Preloads the parser-bearing GeoTIFF loader implementation. */\nasync function preload() {\n const {GeoTIFFLoaderWithParser} = await import('@loaders.gl/raster/geotiff-loader');\n return GeoTIFFLoaderWithParser;\n}\n\n/** Metadata-only GeoTIFF loader. */\nexport const GeoTIFFLoader = {\n /** Matches input for source selection. */\n testURL: (url: string): boolean => {\n if (/\\.ome\\.tiff?(?:$|[?#])/i.test(url)) {\n return false;\n }\n return /\\.(?:geotiff?|tiff?)(?:$|[?#])/i.test(url);\n },\n fromUrl: true,\n fromBlob: true,\n type: 'geotiff',\n dataType: null as unknown as GeoTIFFData,\n batchType: null as never,\n\n ...GeoTIFFFormat,\n version: VERSION,\n options: {\n geotiff: {\n enableAlpha: true\n }\n },\n preload\n} as const satisfies Loader<GeoTIFFData, never, GeoTIFFLoaderOptions>;\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {Loader} from '@loaders.gl/core/loader-utils';\nimport {GeoTIFFFormat} from './geotiff-format';\nimport type {GeoTIFFRasterData, GeoTIFFRasterLoaderOptions} from './geotiff-raster-types';\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/** Loads the optional numeric TIFF parser on first use by an asynchronous core API. */\nasync function preload() {\n const {GeoTIFFRasterLoaderWithParser} = await import('@loaders.gl/raster/geotiff-raster-loader');\n return GeoTIFFRasterLoaderWithParser;\n}\n\n/** Metadata-only loader for original numeric TIFF bands and geospatial metadata. */\nexport const GeoTIFFRasterLoader = {\n ...GeoTIFFFormat,\n id: 'geotiff-raster',\n name: 'GeoTIFF Raster',\n version: VERSION,\n dataType: null as unknown as GeoTIFFRasterData,\n batchType: null as never,\n options: {geotiff: {}},\n preload\n} as const satisfies Loader<GeoTIFFRasterData, never, GeoTIFFRasterLoaderOptions>;\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {Format} from '@loaders.gl/core/loader-utils';\n\nexport const LERCFormat = {\n name: 'LERC',\n id: 'lerc',\n module: 'raster',\n encoding: 'binary',\n format: 'lerc',\n extensions: ['lrc', 'lerc', 'lerc2', 'lerc1'],\n mimeTypes: ['application/octet-stream'],\n binary: true\n} as const satisfies Format;\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {Loader, LoaderOptions} from '@loaders.gl/core/loader-utils';\nimport type {LERCData} from './lib/parsers/lerc/lerc-types';\n\nimport {LERCFormat} from './lerc-format';\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/** Preloads the parser-bearing LERC loader implementation. */\nasync function preload() {\n const {LERCLoaderWithParser} = await import('@loaders.gl/raster/lerc-loader');\n return LERCLoaderWithParser;\n}\n\n/** Metadata-only loader for the LERC raster format. */\nexport const LERCLoader = {\n ...LERCFormat,\n dataType: null as unknown as LERCData,\n batchType: null as never,\n\n id: 'lerc',\n name: 'LERC',\n\n module: 'raster',\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 preload\n} as const satisfies Loader<LERCData, never, LERCLoaderOptions>;\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\n// Version constant cannot be imported, it needs to correspond to the build version of **this** module.\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nexport const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {Format} from '@loaders.gl/core/loader-utils';\n\n/** Image-encoded terrain format. */\nexport const TerrainFormat = {\n name: 'Terrain',\n id: 'terrain',\n module: 'raster',\n encoding: 'image',\n format: 'terrain',\n extensions: ['png', 'pngraw', 'jpg', 'jpeg', 'gif', 'webp', 'bmp'],\n mimeTypes: ['image/png', 'image/jpeg', 'image/gif', 'image/webp', 'image/bmp']\n} as const satisfies Format;\n\n/** Quantized mesh terrain format. */\nexport const QuantizedMeshFormat = {\n name: 'Quantized Mesh',\n id: 'quantized-mesh',\n module: 'raster',\n encoding: 'binary',\n format: 'quantized-mesh',\n extensions: ['terrain'],\n mimeTypes: ['application/vnd.quantized-mesh'],\n binary: true\n} as const satisfies Format;\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {Loader} from '@loaders.gl/core/loader-utils';\nimport type {Table} from 'apache-arrow';\nimport type {Mesh} from '@loaders.gl/core/schema';\nimport type {ImageLoaderOptions} from '@loaders.gl/images';\nimport {VERSION} from './lib/utils/version';\n\nimport type {TerrainOptions} from './lib/parse-terrain';\nimport {TerrainFormat} from './terrain-format';\n\n/** TerrainLoader options */\nexport type TerrainLoaderOptions = ImageLoaderOptions & {\n /** TerrainLoader options */\n terrain?: TerrainOptions & {\n /** Selects mesh output or Apache Arrow output. */\n shape?: 'mesh' | 'arrow';\n /** Override the URL to the worker bundle (by default loads from unpkg.com) */\n workerUrl?: string;\n };\n};\n\n/**\n * Worker loader for image encoded terrain\n */\nexport const TerrainLoader = {\n defaultShape: 'arrow',\n supportsNativeArrow: true,\n dataType: null as unknown as Mesh | Table,\n batchType: null as never,\n\n ...TerrainFormat,\n version: VERSION,\n worker: true,\n /** Loads the parser-bearing terrain loader implementation. */\n preload: async () => (await import('@loaders.gl/raster/terrain-loader')).TerrainLoaderWithParser,\n options: {\n terrain: {\n tesselator: 'auto',\n shape: 'arrow',\n bounds: undefined!,\n meshMaxError: 10,\n elevationDecoder: {\n rScaler: 1,\n gScaler: 0,\n bScaler: 0,\n offset: 0\n },\n skirtHeight: undefined\n }\n }\n} as const satisfies Loader<Mesh | Table, never, TerrainLoaderOptions>;\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {Loader, LoaderOptions} from '@loaders.gl/core/loader-utils';\nimport type {Table} from 'apache-arrow';\nimport type {Mesh} from '@loaders.gl/core/schema';\nimport {VERSION} from './lib/utils/version';\nimport {QuantizedMeshFormat} from './terrain-format';\n\n/** QuantizedMeshLoader options */\nexport type QuantizedMeshLoaderOptions = LoaderOptions & {\n /** QuantizedMeshLoader options */\n 'quantized-mesh'?: {\n /** Selects mesh output or Apache Arrow output. */\n shape?: 'mesh' | 'arrow';\n bounds?: [number, number, number, number];\n skirtHeight?: number | null;\n /** Override the URL to the worker bundle (by default loads from unpkg.com) */\n workerUrl?: string;\n };\n};\n\n/**\n * Worker loader for quantized meshes\n */\nexport const QuantizedMeshLoader = {\n defaultShape: 'arrow',\n supportsNativeArrow: true,\n dataType: null as unknown as Mesh | Table,\n batchType: null as never,\n\n ...QuantizedMeshFormat,\n version: VERSION,\n worker: true,\n /** Loads the parser-bearing quantized mesh loader implementation. */\n preload: async () =>\n (await import('@loaders.gl/raster/quantized-mesh-loader')).QuantizedMeshLoaderWithParser,\n options: {\n 'quantized-mesh': {\n shape: 'arrow',\n bounds: [0, 0, 1, 1],\n skirtHeight: null\n }\n }\n} as const satisfies Loader<Mesh | Table, never, QuantizedMeshLoaderOptions>;\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {Table} from 'apache-arrow';\nimport type {WriterOptions, WriterWithEncoder} from '@loaders.gl/core/loader-utils';\nimport type {Mesh, MeshAttribute} from '@loaders.gl/core/schema';\nimport {convertMeshToArrowTable, convertTableToMesh} from '@loaders.gl/core/schema-utils';\nimport {VERSION} from './lib/utils/version';\nimport {QuantizedMeshFormat} from './terrain-format';\n\nconst QUANTIZED_MESH_HEADER_LENGTH = 88;\nconst QUANTIZED_COORDINATE_RANGE = 32767;\nconst EMPTY_EDGE_INDICES_LENGTH = Uint32Array.BYTES_PER_ELEMENT * 4;\n\n/** Options for `QuantizedMeshWriter`. */\nexport type QuantizedMeshWriterOptions = WriterOptions & {\n /** Quantized mesh-specific writer options. */\n 'quantized-mesh'?: {\n /** Bounds used to map x/y positions to quantized u/v coordinates. */\n bounds?: [number, number, number, number];\n };\n};\n\n/**\n * Writer for the quantized mesh terrain format.\n */\nexport const QuantizedMeshWriter = {\n ...QuantizedMeshFormat,\n version: VERSION,\n dataType: null as unknown as Mesh | Table,\n batchType: null as never,\n options: {\n 'quantized-mesh': {}\n },\n encode: async (data, options) => encodeQuantizedMeshSync(data, options),\n encodeSync: encodeQuantizedMeshSync\n} as const satisfies WriterWithEncoder<Mesh | Table, never, QuantizedMeshWriterOptions>;\n\n/** Encode mesh category data as quantized mesh terrain bytes. */\nfunction encodeQuantizedMeshSync(\n data: Mesh | Table,\n options: QuantizedMeshWriterOptions = {}\n): ArrayBuffer {\n const mesh = convertTableToMesh(normalizeMeshArrowTable(data));\n const positionAttribute = getRequiredAttribute(mesh, 'POSITION');\n const vertexCount = positionAttribute.value.length / positionAttribute.size;\n const boundingBox = getBoundingBox(positionAttribute, vertexCount);\n const bounds = options['quantized-mesh']?.bounds || [\n boundingBox[0][0],\n boundingBox[0][1],\n boundingBox[1][0],\n boundingBox[1][1]\n ];\n const triangleIndices = getTriangleIndices(mesh, vertexCount);\n const highWatermarkMesh = reorderMeshForHighWatermark(triangleIndices, vertexCount);\n const bytesPerIndex =\n vertexCount > 65536 ? Uint32Array.BYTES_PER_ELEMENT : Uint16Array.BYTES_PER_ELEMENT;\n const vertexDataLength =\n Uint32Array.BYTES_PER_ELEMENT + vertexCount * 3 * Uint16Array.BYTES_PER_ELEMENT;\n const triangleDataOffset = getAlignedOffset(\n QUANTIZED_MESH_HEADER_LENGTH + vertexDataLength,\n bytesPerIndex\n );\n const triangleDataLength = Uint32Array.BYTES_PER_ELEMENT + triangleIndices.length * bytesPerIndex;\n const arrayBuffer = new ArrayBuffer(\n triangleDataOffset + triangleDataLength + EMPTY_EDGE_INDICES_LENGTH\n );\n const dataView = new DataView(arrayBuffer);\n\n writeHeader(dataView, boundingBox);\n dataView.setUint32(QUANTIZED_MESH_HEADER_LENGTH, vertexCount, true);\n writeVertexData(dataView, QUANTIZED_MESH_HEADER_LENGTH + Uint32Array.BYTES_PER_ELEMENT, {\n positionAttribute,\n vertexCount,\n boundingBox,\n bounds,\n sourceVertexIndices: highWatermarkMesh.sourceVertexIndices\n });\n writeTriangleIndices(\n dataView,\n triangleDataOffset,\n highWatermarkMesh.triangleIndices,\n bytesPerIndex\n );\n writeEmptyEdgeIndices(dataView, triangleDataOffset + triangleDataLength);\n\n return arrayBuffer;\n}\n\n/** Return mesh data as a native Arrow table, converting plain Mesh data first. */\nfunction normalizeMeshArrowTable(data: Mesh | Table): Table {\n if (!('attributes' in data)) {\n return data;\n }\n return convertMeshToArrowTable(data as Mesh);\n}\n\n/** Return a required mesh attribute or throw a format-specific error. */\nfunction getRequiredAttribute(mesh: Mesh, attributeName: string): MeshAttribute {\n const attribute = mesh.attributes[attributeName];\n if (!attribute) {\n throw new Error(`QuantizedMeshWriter: ${attributeName} attribute is required`);\n }\n return attribute;\n}\n\n/** Write the fixed-length quantized mesh header. */\nfunction writeHeader(\n dataView: DataView,\n boundingBox: [[number, number, number], [number, number, number]]\n): void {\n const center = getCenter(boundingBox);\n const radius = getRadius(boundingBox, center);\n let byteOffset = 0;\n\n for (const value of center) {\n dataView.setFloat64(byteOffset, value, true);\n byteOffset += Float64Array.BYTES_PER_ELEMENT;\n }\n\n dataView.setFloat32(byteOffset, boundingBox[0][2], true);\n byteOffset += Float32Array.BYTES_PER_ELEMENT;\n dataView.setFloat32(byteOffset, boundingBox[1][2], true);\n byteOffset += Float32Array.BYTES_PER_ELEMENT;\n\n for (const value of center) {\n dataView.setFloat64(byteOffset, value, true);\n byteOffset += Float64Array.BYTES_PER_ELEMENT;\n }\n dataView.setFloat64(byteOffset, radius, true);\n byteOffset += Float64Array.BYTES_PER_ELEMENT;\n\n dataView.setFloat64(byteOffset, 0, true);\n dataView.setFloat64(byteOffset + 8, 0, true);\n dataView.setFloat64(byteOffset + 16, 0, true);\n}\n\n/** Write delta and zig-zag encoded u, v, and height vertex arrays. */\nfunction writeVertexData(\n dataView: DataView,\n byteOffset: number,\n parameters: {\n positionAttribute: MeshAttribute;\n vertexCount: number;\n boundingBox: [[number, number, number], [number, number, number]];\n bounds: [number, number, number, number];\n sourceVertexIndices: number[];\n }\n): void {\n const quantizedCoordinates = getQuantizedCoordinates(parameters);\n const arrayByteLength = parameters.vertexCount * Uint16Array.BYTES_PER_ELEMENT;\n\n writeDeltaEncodedArray(dataView, byteOffset, quantizedCoordinates.u);\n writeDeltaEncodedArray(dataView, byteOffset + arrayByteLength, quantizedCoordinates.v);\n writeDeltaEncodedArray(dataView, byteOffset + arrayByteLength * 2, quantizedCoordinates.height);\n}\n\n/** Return quantized u, v, and height arrays from positions. */\nfunction getQuantizedCoordinates(parameters: {\n positionAttribute: MeshAttribute;\n vertexCount: number;\n boundingBox: [[number, number, number], [number, number, number]];\n bounds: [number, number, number, number];\n sourceVertexIndices: number[];\n}): {u: Uint16Array; v: Uint16Array; height: Uint16Array} {\n const [minimumX, minimumY, maximumX, maximumY] = parameters.bounds;\n const heightMinimum = parameters.boundingBox[0][2];\n const heightMaximum = parameters.boundingBox[1][2];\n const u = new Uint16Array(parameters.vertexCount);\n const v = new Uint16Array(parameters.vertexCount);\n const height = new Uint16Array(parameters.vertexCount);\n\n for (let vertexIndex = 0; vertexIndex < parameters.vertexCount; vertexIndex++) {\n const sourceVertexIndex = parameters.sourceVertexIndices[vertexIndex];\n u[vertexIndex] = quantize(\n getComponent(parameters.positionAttribute, sourceVertexIndex, 0),\n minimumX,\n maximumX\n );\n v[vertexIndex] = quantize(\n getComponent(parameters.positionAttribute, sourceVertexIndex, 1),\n minimumY,\n maximumY\n );\n height[vertexIndex] = quantize(\n getComponent(parameters.positionAttribute, sourceVertexIndex, 2),\n heightMinimum,\n heightMaximum\n );\n }\n\n return {u, v, height};\n}\n\n/** Write a delta and zig-zag encoded Uint16 array. */\nfunction writeDeltaEncodedArray(dataView: DataView, byteOffset: number, values: Uint16Array): void {\n let previousValue = 0;\n for (let valueIndex = 0; valueIndex < values.length; valueIndex++) {\n const value = values[valueIndex];\n const delta = value - previousValue;\n dataView.setUint16(\n byteOffset + valueIndex * Uint16Array.BYTES_PER_ELEMENT,\n encodeZigZag(delta),\n true\n );\n previousValue = value;\n }\n}\n\n/** Write high-watermark encoded triangle indices. */\nfunction writeTriangleIndices(\n dataView: DataView,\n byteOffset: number,\n triangleIndices: number[],\n bytesPerIndex: number\n): void {\n dataView.setUint32(byteOffset, triangleIndices.length / 3, true);\n let highestIndex = 0;\n let indexByteOffset = byteOffset + Uint32Array.BYTES_PER_ELEMENT;\n\n for (const triangleIndex of triangleIndices) {\n const code = highestIndex - triangleIndex;\n if (code < 0) {\n throw new Error('QuantizedMeshWriter: triangle indices must be high-watermark encodable');\n }\n\n if (bytesPerIndex === Uint16Array.BYTES_PER_ELEMENT) {\n dataView.setUint16(indexByteOffset, code, true);\n } else {\n dataView.setUint32(indexByteOffset, code, true);\n }\n\n if (code === 0) {\n highestIndex++;\n }\n indexByteOffset += bytesPerIndex;\n }\n}\n\n/** Write empty west, south, east, and north edge-index lists. */\nfunction writeEmptyEdgeIndices(dataView: DataView, byteOffset: number): void {\n dataView.setUint32(byteOffset, 0, true);\n dataView.setUint32(byteOffset + 4, 0, true);\n dataView.setUint32(byteOffset + 8, 0, true);\n dataView.setUint32(byteOffset + 12, 0, true);\n}\n\n/** Return triangle indices for indexed or sequential triangle-list meshes. */\nfunction getTriangleIndices(mesh: Mesh, vertexCount: number): number[] {\n if (mesh.indices?.value?.length) {\n return Array.from(mesh.indices.value);\n }\n\n if (mesh.mode !== 4 && mesh.topology !== 'triangle-list') {\n throw new Error('QuantizedMeshWriter: triangle-list mesh data is required');\n }\n\n const triangleIndices: number[] = [];\n for (let vertexIndex = 0; vertexIndex + 2 < vertexCount; vertexIndex += 3) {\n triangleIndices.push(vertexIndex, vertexIndex + 1, vertexIndex + 2);\n }\n return triangleIndices;\n}\n\n/** Return vertices and indices reordered into first-reference order for high-watermark encoding. */\nfunction reorderMeshForHighWatermark(\n triangleIndices: number[],\n vertexCount: number\n): {triangleIndices: number[]; sourceVertexIndices: number[]} {\n const remappedVertexIndices = new Map<number, number>();\n const sourceVertexIndices: number[] = [];\n const remappedTriangleIndices = triangleIndices.map(triangleIndex => {\n if (!Number.isInteger(triangleIndex) || triangleIndex < 0 || triangleIndex >= vertexCount) {\n throw new Error('QuantizedMeshWriter: triangle index is out of range');\n }\n\n const existingIndex = remappedVertexIndices.get(triangleIndex);\n if (existingIndex !== undefined) {\n return existingIndex;\n }\n\n const nextIndex = sourceVertexIndices.length;\n remappedVertexIndices.set(triangleIndex, nextIndex);\n sourceVertexIndices.push(triangleIndex);\n return nextIndex;\n });\n\n for (let vertexIndex = 0; vertexIndex < vertexCount; vertexIndex++) {\n if (!remappedVertexIndices.has(vertexIndex)) {\n sourceVertexIndices.push(vertexIndex);\n }\n }\n\n return {triangleIndices: remappedTriangleIndices, sourceVertexIndices};\n}\n\n/** Return an aligned byte offset. */\nfunction getAlignedOffset(byteOffset: number, byteAlignment: number): number {\n const remainder = byteOffset % byteAlignment;\n return remainder === 0 ? byteOffset : byteOffset + byteAlignment - remainder;\n}\n\n/** Return a single attribute component with 0 as the missing component fallback. */\nfunction getComponent(\n attribute: MeshAttribute,\n vertexIndex: number,\n componentIndex: number\n): number {\n return attribute.value[vertexIndex * attribute.size + componentIndex] || 0;\n}\n\n/** Compute a bounding box from position data. */\nfunction getBoundingBox(\n positionAttribute: MeshAttribute,\n vertexCount: number\n): [[number, number, number], [number, number, number]] {\n const minimum: [number, number, number] = [\n Number.POSITIVE_INFINITY,\n Number.POSITIVE_INFINITY,\n Number.POSITIVE_INFINITY\n ];\n const maximum: [number, number, number] = [\n Number.NEGATIVE_INFINITY,\n Number.NEGATIVE_INFINITY,\n Number.NEGATIVE_INFINITY\n ];\n\n for (let vertexIndex = 0; vertexIndex < vertexCount; vertexIndex++) {\n for (let componentIndex = 0; componentIndex < 3; componentIndex++) {\n const value = getComponent(positionAttribute, vertexIndex, componentIndex);\n minimum[componentIndex] = Math.min(minimum[componentIndex], value);\n maximum[componentIndex] = Math.max(maximum[componentIndex], value);\n }\n }\n\n return [minimum, maximum];\n}\n\n/** Return the center of a bounding box. */\nfunction getCenter(\n boundingBox: [[number, number, number], [number, number, number]]\n): [number, number, number] {\n return [\n (boundingBox[0][0] + boundingBox[1][0]) / 2,\n (boundingBox[0][1] + boundingBox[1][1]) / 2,\n (boundingBox[0][2] + boundingBox[1][2]) / 2\n ];\n}\n\n/** Return a bounding sphere radius that contains the bounding box. */\nfunction getRadius(\n boundingBox: [[number, number, number], [number, number, number]],\n center: [number, number, number]\n): number {\n const xDistance = Math.max(\n Math.abs(boundingBox[0][0] - center[0]),\n Math.abs(boundingBox[1][0] - center[0])\n );\n const yDistance = Math.max(\n Math.abs(boundingBox[0][1] - center[1]),\n Math.abs(boundingBox[1][1] - center[1])\n );\n const zDistance = Math.max(\n Math.abs(boundingBox[0][2] - center[2]),\n Math.abs(boundingBox[1][2] - center[2])\n );\n return Math.hypot(xDistance, yDistance, zDistance);\n}\n\n/** Quantize a value into the terrain coordinate range. */\nfunction quantize(value: number, minimum: number, maximum: number): number {\n const range = maximum - minimum || 1;\n const quantizedValue = Math.round(((value - minimum) / range) * QUANTIZED_COORDINATE_RANGE);\n return Math.max(0, Math.min(QUANTIZED_COORDINATE_RANGE, quantizedValue));\n}\n\n/** Zig-zag encode a signed delta. */\nfunction encodeZigZag(value: number): number {\n return (value << 1) ^ (value >> 31);\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {SourceLoader} from '@loaders.gl/core/loader-utils';\nimport type {OMETiffImageSource, OMETiffLoaderOptions} from './ometiff-loader';\nimport {OMETiffFormat} from './geotiff-format';\nimport {GeoTIFFLoader} from './geotiff-loader-types';\n\n/** Metadata-only OMETiff source loader. */\nexport const OMETiffLoader = {\n dataType: null as unknown as OMETiffImageSource,\n batchType: null as never,\n ...OMETiffFormat,\n name: 'OMETiffLoader',\n version: GeoTIFFLoader.version,\n type: 'ometiff',\n fromUrl: true,\n fromBlob: true,\n\n options: {\n ometiff: {\n headers: undefined!,\n interleaved: false,\n defaultChannels: undefined!\n }\n },\n\n defaultOptions: {\n ometiff: {\n headers: undefined!,\n interleaved: false,\n defaultChannels: undefined!\n }\n },\n\n testURL: (url: string): boolean => /\\.ome\\.tiff?(?:$|[?#])/i.test(url),\n /** Loads the implementation for asynchronous source construction. */\n preload: async () => (await import('@loaders.gl/raster/ometiff-loader')).OMETiffLoader,\n /** Synchronous construction requires the source implementation subpath. */\n createDataSourceSync(_data: string | Blob, _options: OMETiffLoaderOptions): OMETiffImageSource {\n throw new Error(\n 'OMETiffLoader requires async createDataSource() or its source implementation subpath'\n );\n }\n} as const satisfies SourceLoader<OMETiffImageSource>;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;ACOO,IAAM,gBAAgB;EAC3B,IAAI;EACJ,MAAM;EACN,QAAQ;EACR,UAAU;EACV,QAAQ;EACR,WAAW,CAAC,YAAY;EACxB,YAAY,CAAC,WAAW,QAAQ,UAAU,KAAK;;AAI1C,IAAM,gBAAgB;EAC3B,MAAM;EACN,IAAI;EACJ,QAAQ;EACR,UAAU;EACV,QAAQ;EACR,YAAY,CAAC,WAAW,UAAU;EAClC,WAAW,CAAC,cAAc,eAAe;;;;ACd3C,IAAM,UAAU,OAAoC,kBAAe;AAmBnE,eAAe,UAAO;AACpB,QAAM,EAAC,wBAAuB,IAAI,MAAM,OAAO,mCAAmC;AAClF,SAAO;AACT;AAGO,IAAM,gBAAgB;;EAE3B,SAAS,CAAC,QAAwB;AAChC,QAAI,0BAA0B,KAAK,GAAG,GAAG;AACvC,aAAO;IACT;AACA,WAAO,kCAAkC,KAAK,GAAG;EACnD;EACA,SAAS;EACT,UAAU;EACV,M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;EACV,WAAW;EACX,GAAG;EACH,MAAM;EACN,SAAS,cAAc;EACvB,MAAM;EACN,SAAS;EACT,UAAU;EAEV,SAAS;IACP,SAAS;MACP,SAAS;MACT,aAAa;MACb,iBAAiB;;;EAIrB,gBAAgB;IACd,SAAS;MACP,SAAS;MACT,aAAa;MACb,iBAAiB;;;EAIrB,SAAS,CAAC,QAAyB,0BAA0B,KAAK,GAAG;;EAErE,SAAS,aAAa,MAAM,OAAO,mCAAmC,GAAG;;EAEzE,qBAAqB,OAAsB,UAA8B;AACvE,UAAM,IAAI,MACR,sFAAsF;EAE1F;;",
|
|
6
6
|
"names": ["VERSION", "preload", "VERSION", "preload", "VERSION", "VERSION", "VERSION", "VERSION"]
|
|
7
7
|
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { LERCFormat } from "./lerc-format.js";
|
|
5
5
|
// __VERSION__ is injected by babel-plugin-version-inline
|
|
6
6
|
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
7
|
-
const VERSION = typeof "5.0.0-beta.
|
|
7
|
+
const VERSION = typeof "5.0.0-beta.11" !== 'undefined' ? "5.0.0-beta.11" : 'latest';
|
|
8
8
|
/** Preloads the parser-bearing LERC loader implementation. */
|
|
9
9
|
async function preload() {
|
|
10
10
|
const { LERCLoaderWithParser } = await import('@loaders.gl/raster/lerc-loader');
|
|
@@ -172,9 +172,9 @@
|
|
|
172
172
|
|
|
173
173
|
// ../../node_modules/@math.gl/geospatial/dist/terrain/mesh-skirts.js
|
|
174
174
|
function createTerrainSkirt(mesh, options) {
|
|
175
|
-
const { positions, indices } = mesh, { height, edges } = options;
|
|
175
|
+
const { positions, indices } = mesh, { height, baseZ, edges } = options;
|
|
176
176
|
const maxVertices = options.maxVertices ?? 2e6, maxTriangles = options.maxTriangles ?? 4e6;
|
|
177
|
-
if (!Number.isFinite(height)
|
|
177
|
+
if ((baseZ === void 0 ? !(Number.isFinite(height) && height > 0) : height !== void 0 || !Number.isFinite(baseZ)) || !Number.isSafeInteger(maxVertices) || maxVertices < 0 || maxVertices > 4294967295 || !Number.isSafeInteger(maxTriangles) || maxTriangles < 0 || maxTriangles > 4294967295)
|
|
178
178
|
throw new Error("Invalid terrain skirt height or capacity");
|
|
179
179
|
if (!(positions instanceof Float32Array || positions instanceof Float64Array) || positions.length < 3 || positions.length % 3 || !positions.every(Number.isFinite) || !(indices instanceof Uint16Array || indices instanceof Uint32Array) || indices.length % 3 || positions.length / 3 > maxVertices || indices.length / 3 > maxTriangles)
|
|
180
180
|
throw new Error("Invalid terrain skirt mesh or capacity");
|
|
@@ -230,7 +230,7 @@
|
|
|
230
230
|
[b, lowerB]
|
|
231
231
|
]) {
|
|
232
232
|
resultPositions.set(positions.subarray(3 * source, 3 * source + 3), 3 * target);
|
|
233
|
-
resultPositions[3 * target + 2] = positions[3 * source + 2] - height;
|
|
233
|
+
resultPositions[3 * target + 2] = baseZ ?? positions[3 * source + 2] - height;
|
|
234
234
|
if (!Number.isFinite(resultPositions[3 * target + 2]) || resultPositions[3 * target + 2] >= positions[3 * source + 2])
|
|
235
235
|
throw new Error("Terrain skirt height cannot be represented in position precision");
|
|
236
236
|
sourceVertexIndices[target - vertexCount] = source;
|
|
@@ -15220,6 +15220,20 @@ return true;`);
|
|
|
15220
15220
|
}
|
|
15221
15221
|
});
|
|
15222
15222
|
|
|
15223
|
+
// ../../node_modules/@math.gl/arrow/dist/arrow/arrow-column-utils.js
|
|
15224
|
+
function isArrowTable2(value) {
|
|
15225
|
+
const table = value;
|
|
15226
|
+
return Boolean(table && Number.isInteger(table.numRows) && Array.isArray(table.batches) && Array.isArray(table.schema?.fields) && typeof table.get === "function" && typeof table.getChild === "function");
|
|
15227
|
+
}
|
|
15228
|
+
function isArrowRecordBatch2(value) {
|
|
15229
|
+
const batch = value;
|
|
15230
|
+
return Boolean(batch && Number.isInteger(batch.numRows) && Array.isArray(batch.schema?.fields) && Array.isArray(batch.data?.children) && typeof batch.get === "function" && typeof batch.getChild === "function");
|
|
15231
|
+
}
|
|
15232
|
+
var init_arrow_column_utils = __esm({
|
|
15233
|
+
"../../node_modules/@math.gl/arrow/dist/arrow/arrow-column-utils.js"() {
|
|
15234
|
+
}
|
|
15235
|
+
});
|
|
15236
|
+
|
|
15223
15237
|
// ../../node_modules/@math.gl/arrow/dist/arrow/split-arrow-buffers.js
|
|
15224
15238
|
function splitArrowBuffers(input, options = {}) {
|
|
15225
15239
|
const retainedBuffers = /* @__PURE__ */ new Set();
|
|
@@ -15241,12 +15255,6 @@ return true;`);
|
|
|
15241
15255
|
}
|
|
15242
15256
|
return splitArrowDataBuffers(input, context);
|
|
15243
15257
|
}
|
|
15244
|
-
function isArrowTable2(input) {
|
|
15245
|
-
return "batches" in input;
|
|
15246
|
-
}
|
|
15247
|
-
function isArrowRecordBatch2(input) {
|
|
15248
|
-
return "schema" in input && "data" in input && !Array.isArray(input.data);
|
|
15249
|
-
}
|
|
15250
15258
|
function isArrowVector2(input) {
|
|
15251
15259
|
return "data" in input && Array.isArray(input.data);
|
|
15252
15260
|
}
|
|
@@ -15318,6 +15326,7 @@ return true;`);
|
|
|
15318
15326
|
init_Arrow_dom();
|
|
15319
15327
|
init_arrow_record_batch();
|
|
15320
15328
|
init_arrow_data();
|
|
15329
|
+
init_arrow_column_utils();
|
|
15321
15330
|
}
|
|
15322
15331
|
});
|
|
15323
15332
|
|
|
@@ -15430,12 +15439,6 @@ return true;`);
|
|
|
15430
15439
|
}
|
|
15431
15440
|
});
|
|
15432
15441
|
|
|
15433
|
-
// ../../node_modules/@math.gl/arrow/dist/arrow/arrow-column-utils.js
|
|
15434
|
-
var init_arrow_column_utils = __esm({
|
|
15435
|
-
"../../node_modules/@math.gl/arrow/dist/arrow/arrow-column-utils.js"() {
|
|
15436
|
-
}
|
|
15437
|
-
});
|
|
15438
|
-
|
|
15439
15442
|
// ../../node_modules/@math.gl/arrow/dist/arrow/index.js
|
|
15440
15443
|
var init_arrow = __esm({
|
|
15441
15444
|
"../../node_modules/@math.gl/arrow/dist/arrow/index.js"() {
|
|
@@ -15460,16 +15463,6 @@ return true;`);
|
|
|
15460
15463
|
});
|
|
15461
15464
|
|
|
15462
15465
|
// ../core/src/arrow-worker-transport.ts
|
|
15463
|
-
function deserializeArrowWorkerTable(result) {
|
|
15464
|
-
if (isArrowWorkerEnvelope(result)) {
|
|
15465
|
-
return { ...result.metadata, shape: "arrow-table", data: hydrateWorkerTable(result) };
|
|
15466
|
-
}
|
|
15467
|
-
if (isLegacyArrowWorkerEnvelope(result)) {
|
|
15468
|
-
const { arrowBatchMetadata: _snapshots, data: _columns, ...metadata } = result;
|
|
15469
|
-
return { ...metadata, data: hydrateWorkerTable(result) };
|
|
15470
|
-
}
|
|
15471
|
-
throw new Error("Workers require Arrow column transport");
|
|
15472
|
-
}
|
|
15473
15466
|
function serializeNativeArrowWorkerResult(result, options = { copy: "all" }) {
|
|
15474
15467
|
const batch = result instanceof RecordBatch3;
|
|
15475
15468
|
if (!batch && !(result instanceof Table)) {
|
|
@@ -15493,62 +15486,26 @@ return true;`);
|
|
|
15493
15486
|
}
|
|
15494
15487
|
function serializeArrowWorkerResult(result, options) {
|
|
15495
15488
|
const workerOptions = options;
|
|
15496
|
-
const
|
|
15497
|
-
|
|
15498
|
-
return serializeNativeArrowWorkerResult(result, { copy: bufferCopyMode ?? "all" });
|
|
15499
|
-
}
|
|
15500
|
-
if (!isArrowTableWrapper(result)) {
|
|
15501
|
-
return result;
|
|
15502
|
-
}
|
|
15503
|
-
const { data, shape: _shape, ...metadata } = result;
|
|
15504
|
-
return {
|
|
15505
|
-
transport: "arrow-column-envelope",
|
|
15506
|
-
metadata: structuredClone(metadata),
|
|
15507
|
-
...serializeWorkerColumns(data, bufferCopyMode ? { copy: bufferCopyMode } : void 0)
|
|
15508
|
-
};
|
|
15489
|
+
const copy = workerOptions?.core?.workerTransferBufferCopy ?? workerOptions?.workerTransferBufferCopy;
|
|
15490
|
+
return result instanceof Table || result instanceof RecordBatch3 ? serializeNativeArrowWorkerResult(result, { copy: copy ?? "all" }) : result;
|
|
15509
15491
|
}
|
|
15510
15492
|
function deserializeArrowWorkerResult(result) {
|
|
15511
15493
|
const transport = result?.transport;
|
|
15512
|
-
|
|
15513
|
-
return deserializeNativeArrowWorkerResult(result);
|
|
15514
|
-
}
|
|
15515
|
-
return isArrowWorkerEnvelope(result) || isLegacyArrowWorkerEnvelope(result) ? deserializeArrowWorkerTable(result) : result;
|
|
15516
|
-
}
|
|
15517
|
-
function isArrowTableWrapper(value) {
|
|
15518
|
-
const table = value;
|
|
15519
|
-
return Boolean(
|
|
15520
|
-
table && table.shape === "arrow-table" && table.data && typeof table.data === "object" && "batches" in table.data
|
|
15521
|
-
);
|
|
15494
|
+
return transport === "arrow-table-columns" || transport === "arrow-record-batch" ? deserializeNativeArrowWorkerResult(result) : result;
|
|
15522
15495
|
}
|
|
15523
15496
|
function hasArrowWorkerColumns(value) {
|
|
15524
15497
|
const columns = value;
|
|
15525
15498
|
return columns?.data?.transport === "arrow-js" && Array.isArray(columns.data.batches);
|
|
15526
15499
|
}
|
|
15527
|
-
function isArrowWorkerEnvelope(value) {
|
|
15528
|
-
return value?.transport === "arrow-column-envelope" && hasArrowWorkerColumns(value);
|
|
15529
|
-
}
|
|
15530
|
-
function isLegacyArrowWorkerEnvelope(value) {
|
|
15531
|
-
return value?.shape === "arrow-table" && hasArrowWorkerColumns(value);
|
|
15532
|
-
}
|
|
15533
15500
|
function serializeWorkerColumns(table, options) {
|
|
15534
15501
|
return {
|
|
15535
15502
|
arrowBatchMetadata: snapshotBatchMetadata(table),
|
|
15536
|
-
data:
|
|
15503
|
+
data: dehydrateArrowTable(table, options)
|
|
15537
15504
|
};
|
|
15538
15505
|
}
|
|
15539
|
-
function dehydrateWorkerTable(table, options) {
|
|
15540
|
-
const payload = dehydrateArrowTable(table, options);
|
|
15541
|
-
if (table.numCols === 0) {
|
|
15542
|
-
for (const [index, batch] of table.batches.entries()) {
|
|
15543
|
-
payload.batches[index].length = batch.numRows;
|
|
15544
|
-
}
|
|
15545
|
-
}
|
|
15546
|
-
return payload;
|
|
15547
|
-
}
|
|
15548
15506
|
function snapshotBatchMetadata(table) {
|
|
15549
15507
|
return table.batches.map((batch) => ({
|
|
15550
|
-
schema: tableToIPC(new Table(batch.schema, []))
|
|
15551
|
-
metadata: Array.from(batch.metadata)
|
|
15508
|
+
schema: tableToIPC(new Table(batch.schema, []))
|
|
15552
15509
|
}));
|
|
15553
15510
|
}
|
|
15554
15511
|
function hydrateWorkerTable(result) {
|
|
@@ -15556,18 +15513,11 @@ return true;`);
|
|
|
15556
15513
|
const table = hydrateArrowTable(data);
|
|
15557
15514
|
const batches = table.batches.map((batch, index) => {
|
|
15558
15515
|
const snapshot = arrowBatchMetadata?.[index];
|
|
15559
|
-
|
|
15516
|
+
return snapshot ? createRecordBatchWithMetadata(
|
|
15560
15517
|
tableFromIPC(snapshot.schema).schema,
|
|
15561
15518
|
batch.data,
|
|
15562
|
-
new Map(snapshot.metadata)
|
|
15519
|
+
snapshot.metadata ? new Map(snapshot.metadata) : getRecordBatchMetadata(batch)
|
|
15563
15520
|
) : batch;
|
|
15564
|
-
const rowCount = data.batches[index].length;
|
|
15565
|
-
if (restored.numCols === 0 && restored.numRows !== rowCount) {
|
|
15566
|
-
Object.defineProperty(restored, "data", {
|
|
15567
|
-
value: new Data(new Struct([]), 0, rowCount, 0, void 0, [])
|
|
15568
|
-
});
|
|
15569
|
-
}
|
|
15570
|
-
return restored;
|
|
15571
15521
|
});
|
|
15572
15522
|
return new Table(table.schema, batches);
|
|
15573
15523
|
}
|
|
@@ -16075,7 +16025,7 @@ return true;`);
|
|
|
16075
16025
|
});
|
|
16076
16026
|
|
|
16077
16027
|
// ../core/src/lib/loader-utils/native-arrow.ts
|
|
16078
|
-
function
|
|
16028
|
+
function isArrowTable3(value) {
|
|
16079
16029
|
return Boolean(
|
|
16080
16030
|
value && typeof value === "object" && "schema" in value && "batches" in value && Array.isArray(value.batches) && "numRows" in value && typeof value.numRows === "number" && "getChildAt" in value && typeof value.getChildAt === "function"
|
|
16081
16031
|
);
|
|
@@ -16279,7 +16229,7 @@ return true;`);
|
|
|
16279
16229
|
});
|
|
16280
16230
|
|
|
16281
16231
|
// ../core/src/schema-utils/lib/mesh/convert-mesh-to-table.ts
|
|
16282
|
-
function
|
|
16232
|
+
function convertMeshToArrowTable(mesh) {
|
|
16283
16233
|
return makeMeshArrowTable(mesh.attributes, {
|
|
16284
16234
|
schema: mesh.schema,
|
|
16285
16235
|
topology: mesh.topology,
|
|
@@ -16300,22 +16250,14 @@ return true;`);
|
|
|
16300
16250
|
fields.push(
|
|
16301
16251
|
getAttributeArrowField(options.schema, attributeName, column, attribute.componentType)
|
|
16302
16252
|
);
|
|
16303
|
-
if (attributeName ===
|
|
16253
|
+
if (attributeName === attributeNames[0] && options.indices?.value?.length) {
|
|
16304
16254
|
const indicesField = indexedMeshArrowSchema.fields.find((field) => field.name === "indices");
|
|
16305
16255
|
columns.indices = getIndicesVector(options.indices.value, column.length, indicesField.type);
|
|
16306
16256
|
fields.push(indicesField);
|
|
16307
16257
|
}
|
|
16308
16258
|
}
|
|
16309
16259
|
const arrowSchema = new Schema2(fields, getMeshArrowMetadata(options));
|
|
16310
|
-
|
|
16311
|
-
const schema = serializeArrowSchema(table.schema);
|
|
16312
|
-
return {
|
|
16313
|
-
shape: "arrow-table",
|
|
16314
|
-
schema,
|
|
16315
|
-
data: table,
|
|
16316
|
-
topology: options.topology || "point-list",
|
|
16317
|
-
indices: options.indices
|
|
16318
|
-
};
|
|
16260
|
+
return columns[attributeNames[0]]?.length === 0 ? new Table(arrowSchema) : new Table(arrowSchema, columns);
|
|
16319
16261
|
}
|
|
16320
16262
|
function getAttributeArrowVector(value, size, componentType) {
|
|
16321
16263
|
if (componentType === "float16") {
|
|
@@ -16440,18 +16382,10 @@ return true;`);
|
|
|
16440
16382
|
|
|
16441
16383
|
// ../core/src/schema-utils/lib/mesh/convert-table-to-mesh.ts
|
|
16442
16384
|
function convertTableToMesh(table) {
|
|
16443
|
-
if (
|
|
16444
|
-
|
|
16445
|
-
// case 'columnar-table':
|
|
16446
|
-
// return convertColumnarTableToMesh(table);
|
|
16447
|
-
case "arrow-table":
|
|
16448
|
-
return convertArrowTableToMesh(table);
|
|
16449
|
-
default:
|
|
16450
|
-
throw new Error(table.shape);
|
|
16451
|
-
}
|
|
16385
|
+
if (isArrowTable3(table)) return convertArrowTableToMesh(table);
|
|
16386
|
+
throw new Error(table.shape);
|
|
16452
16387
|
}
|
|
16453
|
-
function convertArrowTableToMesh(
|
|
16454
|
-
const arrowTable = isNativeArrowTable(table) ? table : table.data;
|
|
16388
|
+
function convertArrowTableToMesh(arrowTable) {
|
|
16455
16389
|
const schema = serializeArrowSchema(arrowTable.schema);
|
|
16456
16390
|
const localBounds = arrowTable.batches.length === 1 ? arrowTable.batches[0].metadata.get("boundingBox") : void 0;
|
|
16457
16391
|
if (localBounds) schema.metadata = { ...schema.metadata, boundingBox: localBounds };
|
|
@@ -16555,13 +16489,18 @@ return true;`);
|
|
|
16555
16489
|
if (!(attributeData.type instanceof FixedSizeList2)) {
|
|
16556
16490
|
return attributeData.toArray();
|
|
16557
16491
|
}
|
|
16558
|
-
|
|
16492
|
+
if (attributeData.length === 0) {
|
|
16493
|
+
const EmptyStorage = attributeData.type.valueType.ArrayType;
|
|
16494
|
+
return new EmptyStorage(0);
|
|
16495
|
+
}
|
|
16496
|
+
const values = attributeData.data.find((chunk) => chunk.length > 0).children[0].values;
|
|
16559
16497
|
const TypedArrayConstructor = values.constructor;
|
|
16560
16498
|
const typedArray = new TypedArrayConstructor(attributeData.length * size);
|
|
16561
16499
|
let targetOffset = 0;
|
|
16562
16500
|
for (const data of attributeData.data) {
|
|
16563
|
-
const child = data.children[0];
|
|
16564
16501
|
const sourceLength = data.length * size;
|
|
16502
|
+
if (sourceLength === 0) continue;
|
|
16503
|
+
const child = data.children[0];
|
|
16565
16504
|
const sourceOffset = child.offset || data.offset * size;
|
|
16566
16505
|
const sourceStart = sourceOffset + sourceLength <= child.values.length ? sourceOffset : 0;
|
|
16567
16506
|
const source = child.values.subarray(sourceStart, sourceStart + sourceLength);
|
|
@@ -17060,7 +16999,7 @@ return true;`);
|
|
|
17060
16999
|
var init_version = __esm({
|
|
17061
17000
|
"src/terrain/lib/utils/version.ts"() {
|
|
17062
17001
|
"use strict";
|
|
17063
|
-
VERSION = true ? "5.0.0-beta.
|
|
17002
|
+
VERSION = true ? "5.0.0-beta.11" : "latest";
|
|
17064
17003
|
}
|
|
17065
17004
|
});
|
|
17066
17005
|
|
|
@@ -17125,9 +17064,9 @@ return true;`);
|
|
|
17125
17064
|
// src/terrain/quantized-mesh-loader.ts
|
|
17126
17065
|
function parseQuantizedMeshInRequestedShape(arrayBuffer, options) {
|
|
17127
17066
|
const mesh = parseQuantizedMesh(arrayBuffer, options?.["quantized-mesh"]);
|
|
17128
|
-
const table =
|
|
17067
|
+
const table = convertMeshToArrowTable(mesh);
|
|
17129
17068
|
if (options?.["quantized-mesh"]?.shape === "arrow") {
|
|
17130
|
-
return table
|
|
17069
|
+
return table;
|
|
17131
17070
|
}
|
|
17132
17071
|
return {
|
|
17133
17072
|
...convertTableToMesh(table),
|