@loaders.gl/raster 5.0.0-beta.1 → 5.0.0-beta.4
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/README.md +6 -2
- package/THIRD-PARTY-NOTICES.md +1 -1
- package/dist/geotiff/advanced.cjs +16 -11
- package/dist/geotiff/advanced.cjs.map +2 -2
- package/dist/geotiff/geotiff-loader-types.d.ts +1 -1
- package/dist/geotiff/geotiff-loader-types.js +2 -2
- package/dist/geotiff/geotiff-loader-types.js.map +1 -1
- package/dist/geotiff/geotiff-raster-loader-types.d.ts.map +1 -1
- package/dist/geotiff/geotiff-raster-loader-types.js +2 -2
- package/dist/geotiff/geotiff-raster-loader-types.js.map +1 -1
- package/dist/geotiff/geotiff-source-loader-types.js +1 -1
- package/dist/geotiff/geotiff-source-loader-types.js.map +1 -1
- package/dist/geotiff/geotiff-source-loader.js +1 -1
- package/dist/geotiff/lib/ome/load-ome-tiff.d.ts +1 -0
- package/dist/geotiff/lib/ome/load-ome-tiff.d.ts.map +1 -1
- package/dist/geotiff/lib/ome/load-ome-tiff.js +7 -1
- package/dist/geotiff/lib/ome/load-ome-tiff.js.map +1 -1
- package/dist/geotiff/lib/ome/omexml.d.ts.map +1 -1
- package/dist/geotiff/lib/ome/omexml.js +5 -4
- package/dist/geotiff/lib/ome/omexml.js.map +1 -1
- package/dist/geotiff/lib/tiff/tiff-gdal-metadata.d.ts.map +1 -1
- package/dist/geotiff/lib/tiff/tiff-gdal-metadata.js +6 -5
- package/dist/geotiff/lib/tiff/tiff-gdal-metadata.js.map +1 -1
- package/dist/geotiff/loaders.js +1 -1
- package/dist/geotiff/ometiff-source-loader-types.js +1 -1
- package/dist/geotiff/ometiff-source-loader-types.js.map +1 -1
- package/dist/geotiff/ometiff-source-loader.js +1 -1
- package/dist/geotiff-loader-types.d.ts +2 -0
- package/dist/geotiff-loader-types.d.ts.map +1 -0
- package/dist/geotiff-loader-types.js +2 -0
- package/dist/geotiff-loader-types.js.map +1 -0
- package/dist/geotiff-loader.d.ts +2 -0
- package/dist/geotiff-loader.d.ts.map +1 -0
- package/dist/geotiff-loader.js +2 -0
- package/dist/geotiff-loader.js.map +1 -0
- package/dist/geotiff-raster-loader-types.d.ts +2 -0
- package/dist/geotiff-raster-loader-types.d.ts.map +1 -0
- package/dist/geotiff-raster-loader-types.js +2 -0
- package/dist/geotiff-raster-loader-types.js.map +1 -0
- package/dist/geotiff-raster-loader.d.ts +2 -0
- package/dist/geotiff-raster-loader.d.ts.map +1 -0
- package/dist/geotiff-raster-loader.js +2 -0
- package/dist/geotiff-raster-loader.js.map +1 -0
- package/dist/geotiff-source-loader-types.d.ts +2 -0
- package/dist/geotiff-source-loader-types.d.ts.map +1 -0
- package/dist/geotiff-source-loader-types.js +2 -0
- package/dist/geotiff-source-loader-types.js.map +1 -0
- package/dist/geotiff-source-loader.d.ts +2 -0
- package/dist/geotiff-source-loader.d.ts.map +1 -0
- package/dist/geotiff-source-loader.js +2 -0
- package/dist/geotiff-source-loader.js.map +1 -0
- package/dist/index.cjs +11 -11
- package/dist/index.cjs.map +2 -2
- package/dist/lerc/lerc-loader-types.d.ts +1 -1
- package/dist/lerc/lerc-loader-types.js +2 -2
- package/dist/lerc/lerc-loader-types.js.map +1 -1
- package/dist/lerc-loader-types.d.ts +2 -0
- package/dist/lerc-loader-types.d.ts.map +1 -0
- package/dist/lerc-loader-types.js +2 -0
- package/dist/lerc-loader-types.js.map +1 -0
- package/dist/lerc-loader.d.ts +2 -0
- package/dist/lerc-loader.d.ts.map +1 -0
- package/dist/lerc-loader.js +2 -0
- package/dist/lerc-loader.js.map +1 -0
- package/dist/ometiff-source-loader-types.d.ts +2 -0
- package/dist/ometiff-source-loader-types.d.ts.map +1 -0
- package/dist/ometiff-source-loader-types.js +2 -0
- package/dist/ometiff-source-loader-types.js.map +1 -0
- package/dist/ometiff-source-loader.d.ts +2 -0
- package/dist/ometiff-source-loader.d.ts.map +1 -0
- package/dist/ometiff-source-loader.js +2 -0
- package/dist/ometiff-source-loader.js.map +1 -0
- package/dist/quantized-mesh-loader-types.d.ts +2 -0
- package/dist/quantized-mesh-loader-types.d.ts.map +1 -0
- package/dist/quantized-mesh-loader-types.js +2 -0
- package/dist/quantized-mesh-loader-types.js.map +1 -0
- package/dist/quantized-mesh-loader.d.ts +2 -0
- package/dist/quantized-mesh-loader.d.ts.map +1 -0
- package/dist/quantized-mesh-loader.js +2 -0
- package/dist/quantized-mesh-loader.js.map +1 -0
- package/dist/quantized-mesh-worker.js +600 -123
- package/dist/quantized-mesh-writer.d.ts +2 -0
- package/dist/quantized-mesh-writer.d.ts.map +1 -0
- package/dist/quantized-mesh-writer.js +2 -0
- package/dist/quantized-mesh-writer.js.map +1 -0
- package/dist/terrain/index.cjs +24 -523
- package/dist/terrain/index.cjs.map +4 -4
- package/dist/terrain/lib/parse-terrain.d.ts +2 -0
- package/dist/terrain/lib/parse-terrain.d.ts.map +1 -1
- package/dist/terrain/lib/parse-terrain.js +23 -38
- package/dist/terrain/lib/parse-terrain.js.map +1 -1
- package/dist/terrain/lib/utils/version.js +1 -1
- package/dist/terrain/quantized-mesh-loader-types.d.ts.map +1 -1
- package/dist/terrain/quantized-mesh-loader-types.js +1 -2
- package/dist/terrain/quantized-mesh-loader-types.js.map +1 -1
- package/dist/terrain/terrain-loader-types.d.ts +2 -2
- package/dist/terrain/terrain-loader-types.d.ts.map +1 -1
- package/dist/terrain/terrain-loader-types.js +1 -1
- package/dist/terrain/terrain-loader-types.js.map +1 -1
- package/dist/terrain/terrain-loader.js +3 -3
- package/dist/terrain/terrain-loader.js.map +1 -1
- package/dist/terrain-loader-types.d.ts +2 -0
- package/dist/terrain-loader-types.d.ts.map +1 -0
- package/dist/terrain-loader-types.js +2 -0
- package/dist/terrain-loader-types.js.map +1 -0
- package/dist/terrain-loader.d.ts +2 -0
- package/dist/terrain-loader.d.ts.map +1 -0
- package/dist/terrain-loader.js +2 -0
- package/dist/terrain-loader.js.map +1 -0
- package/dist/terrain-worker.js +4641 -3581
- package/package.json +80 -54
- package/src/geotiff/geotiff-loader-types.ts +1 -1
- package/src/geotiff/geotiff-raster-loader-types.ts +1 -3
- package/src/geotiff/geotiff-source-loader-types.ts +1 -1
- package/src/geotiff/lib/ome/load-ome-tiff.ts +7 -1
- package/src/geotiff/lib/ome/omexml.ts +5 -4
- package/src/geotiff/lib/tiff/tiff-gdal-metadata.ts +6 -5
- package/src/geotiff/ometiff-source-loader-types.ts +1 -1
- package/src/geotiff-loader-types.ts +1 -0
- package/src/geotiff-loader.ts +1 -0
- package/src/geotiff-raster-loader-types.ts +1 -0
- package/src/geotiff-raster-loader.ts +1 -0
- package/src/geotiff-source-loader-types.ts +1 -0
- package/src/geotiff-source-loader.ts +1 -0
- package/src/lerc/lerc-loader-types.ts +1 -1
- package/src/lerc-loader-types.ts +1 -0
- package/src/lerc-loader.ts +1 -0
- package/src/ometiff-source-loader-types.ts +1 -0
- package/src/ometiff-source-loader.ts +1 -0
- package/src/quantized-mesh-loader-types.ts +1 -0
- package/src/quantized-mesh-loader.ts +1 -0
- package/src/quantized-mesh-writer.ts +1 -0
- package/src/terrain/lib/parse-terrain.ts +36 -40
- package/src/terrain/quantized-mesh-loader-types.ts +1 -2
- package/src/terrain/terrain-loader-types.ts +3 -4
- package/src/terrain/terrain-loader.ts +3 -3
- package/src/terrain-loader-types.ts +1 -0
- package/src/terrain-loader.ts +1 -0
- package/dist/terrain/libs/README.md +0 -10
- package/dist/terrain/libs/martini-LICENSE +0 -15
- package/dist/terrain/libs/martini.d.mts +0 -19
- package/dist/terrain/libs/martini.mjs +0 -164
- package/src/terrain/libs/README.md +0 -10
- package/src/terrain/libs/martini-LICENSE +0 -15
- package/src/terrain/libs/martini.d.mts +0 -19
- package/src/terrain/libs/martini.mjs +0 -164
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loaders.gl/raster",
|
|
3
|
-
"version": "5.0.0-beta.
|
|
4
|
-
"description": "GeoTIFF, LERC and terrain loaders
|
|
3
|
+
"version": "5.0.0-beta.4",
|
|
4
|
+
"description": "GeoTIFF, OME-TIFF, LERC, and terrain raster loaders",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"publishConfig": {
|
|
@@ -32,29 +32,29 @@
|
|
|
32
32
|
"types": "./dist/geotiff/geotiff-format.d.ts",
|
|
33
33
|
"import": "./dist/geotiff/geotiff-format.js"
|
|
34
34
|
},
|
|
35
|
-
"./geotiff
|
|
36
|
-
"types": "./dist/geotiff
|
|
37
|
-
"import": "./dist/geotiff
|
|
35
|
+
"./geotiff-loader-types": {
|
|
36
|
+
"types": "./dist/geotiff-loader-types.d.ts",
|
|
37
|
+
"import": "./dist/geotiff-loader-types.js"
|
|
38
38
|
},
|
|
39
|
-
"./geotiff
|
|
40
|
-
"types": "./dist/geotiff
|
|
41
|
-
"import": "./dist/geotiff
|
|
39
|
+
"./geotiff-loader": {
|
|
40
|
+
"types": "./dist/geotiff-loader.d.ts",
|
|
41
|
+
"import": "./dist/geotiff-loader.js"
|
|
42
42
|
},
|
|
43
|
-
"./geotiff
|
|
44
|
-
"types": "./dist/geotiff
|
|
45
|
-
"import": "./dist/geotiff
|
|
43
|
+
"./geotiff-raster-loader-types": {
|
|
44
|
+
"types": "./dist/geotiff-raster-loader-types.d.ts",
|
|
45
|
+
"import": "./dist/geotiff-raster-loader-types.js"
|
|
46
46
|
},
|
|
47
|
-
"./geotiff
|
|
48
|
-
"types": "./dist/geotiff
|
|
49
|
-
"import": "./dist/geotiff
|
|
47
|
+
"./geotiff-raster-loader": {
|
|
48
|
+
"types": "./dist/geotiff-raster-loader.d.ts",
|
|
49
|
+
"import": "./dist/geotiff-raster-loader.js"
|
|
50
50
|
},
|
|
51
51
|
"./geotiff/geotiff-raster-types": {
|
|
52
52
|
"types": "./dist/geotiff/geotiff-raster-types.d.ts",
|
|
53
53
|
"import": "./dist/geotiff/geotiff-raster-types.js"
|
|
54
54
|
},
|
|
55
|
-
"./geotiff
|
|
56
|
-
"types": "./dist/geotiff
|
|
57
|
-
"import": "./dist/geotiff
|
|
55
|
+
"./geotiff-source-loader": {
|
|
56
|
+
"types": "./dist/geotiff-source-loader.d.ts",
|
|
57
|
+
"import": "./dist/geotiff-source-loader.js"
|
|
58
58
|
},
|
|
59
59
|
"./geotiff/index": {
|
|
60
60
|
"types": "./dist/geotiff/advanced.d.ts",
|
|
@@ -137,9 +137,9 @@
|
|
|
137
137
|
"types": "./dist/geotiff/loaders.d.ts",
|
|
138
138
|
"import": "./dist/geotiff/loaders.js"
|
|
139
139
|
},
|
|
140
|
-
"./
|
|
141
|
-
"types": "./dist/
|
|
142
|
-
"import": "./dist/
|
|
140
|
+
"./ometiff-source-loader": {
|
|
141
|
+
"types": "./dist/ometiff-source-loader.d.ts",
|
|
142
|
+
"import": "./dist/ometiff-source-loader.js"
|
|
143
143
|
},
|
|
144
144
|
"./geotiff/types": {
|
|
145
145
|
"types": "./dist/geotiff/types.d.ts",
|
|
@@ -169,13 +169,13 @@
|
|
|
169
169
|
"types": "./dist/lerc/lerc-format.d.ts",
|
|
170
170
|
"import": "./dist/lerc/lerc-format.js"
|
|
171
171
|
},
|
|
172
|
-
"./lerc
|
|
173
|
-
"types": "./dist/lerc
|
|
174
|
-
"import": "./dist/lerc
|
|
172
|
+
"./lerc-loader-types": {
|
|
173
|
+
"types": "./dist/lerc-loader-types.d.ts",
|
|
174
|
+
"import": "./dist/lerc-loader-types.js"
|
|
175
175
|
},
|
|
176
|
-
"./lerc
|
|
177
|
-
"types": "./dist/lerc
|
|
178
|
-
"import": "./dist/lerc
|
|
176
|
+
"./lerc-loader": {
|
|
177
|
+
"types": "./dist/lerc-loader.d.ts",
|
|
178
|
+
"import": "./dist/lerc-loader.js"
|
|
179
179
|
},
|
|
180
180
|
"./lerc/lerc-wasm-url": {
|
|
181
181
|
"types": "./dist/lerc/lerc-wasm-url.d.ts",
|
|
@@ -259,29 +259,29 @@
|
|
|
259
259
|
"types": "./dist/terrain/lib/utils/version.d.ts",
|
|
260
260
|
"import": "./dist/terrain/lib/utils/version.js"
|
|
261
261
|
},
|
|
262
|
-
"./
|
|
263
|
-
"types": "./dist/
|
|
264
|
-
"import": "./dist/
|
|
262
|
+
"./quantized-mesh-loader-types": {
|
|
263
|
+
"types": "./dist/quantized-mesh-loader-types.d.ts",
|
|
264
|
+
"import": "./dist/quantized-mesh-loader-types.js"
|
|
265
265
|
},
|
|
266
|
-
"./
|
|
267
|
-
"types": "./dist/
|
|
268
|
-
"import": "./dist/
|
|
266
|
+
"./quantized-mesh-loader": {
|
|
267
|
+
"types": "./dist/quantized-mesh-loader.d.ts",
|
|
268
|
+
"import": "./dist/quantized-mesh-loader.js"
|
|
269
269
|
},
|
|
270
|
-
"./
|
|
271
|
-
"types": "./dist/
|
|
272
|
-
"import": "./dist/
|
|
270
|
+
"./quantized-mesh-writer": {
|
|
271
|
+
"types": "./dist/quantized-mesh-writer.d.ts",
|
|
272
|
+
"import": "./dist/quantized-mesh-writer.js"
|
|
273
273
|
},
|
|
274
274
|
"./terrain/terrain-format": {
|
|
275
275
|
"types": "./dist/terrain/terrain-format.d.ts",
|
|
276
276
|
"import": "./dist/terrain/terrain-format.js"
|
|
277
277
|
},
|
|
278
|
-
"./terrain
|
|
279
|
-
"types": "./dist/terrain
|
|
280
|
-
"import": "./dist/terrain
|
|
278
|
+
"./terrain-loader-types": {
|
|
279
|
+
"types": "./dist/terrain-loader-types.d.ts",
|
|
280
|
+
"import": "./dist/terrain-loader-types.js"
|
|
281
281
|
},
|
|
282
|
-
"./terrain
|
|
283
|
-
"types": "./dist/terrain
|
|
284
|
-
"import": "./dist/terrain
|
|
282
|
+
"./terrain-loader": {
|
|
283
|
+
"types": "./dist/terrain-loader.d.ts",
|
|
284
|
+
"import": "./dist/terrain-loader.js"
|
|
285
285
|
},
|
|
286
286
|
"./terrain/unbundled": {
|
|
287
287
|
"types": "./dist/terrain/unbundled.d.ts",
|
|
@@ -289,7 +289,8 @@
|
|
|
289
289
|
},
|
|
290
290
|
"./terrain": {
|
|
291
291
|
"types": "./dist/terrain/index.d.ts",
|
|
292
|
-
"import": "./dist/terrain/index.js"
|
|
292
|
+
"import": "./dist/terrain/index.js",
|
|
293
|
+
"require": "./dist/terrain/index.cjs"
|
|
293
294
|
},
|
|
294
295
|
"./terrain-worker.js": {
|
|
295
296
|
"import": "./dist/terrain-worker.js"
|
|
@@ -298,13 +299,13 @@
|
|
|
298
299
|
"import": "./dist/quantized-mesh-worker.js"
|
|
299
300
|
},
|
|
300
301
|
"./lerc/lerc-wasm.wasm": "./dist/lerc/libs/lerc/lerc-wasm.wasm",
|
|
301
|
-
"./geotiff
|
|
302
|
-
"types": "./dist/geotiff
|
|
303
|
-
"import": "./dist/geotiff
|
|
302
|
+
"./geotiff-source-loader-types": {
|
|
303
|
+
"types": "./dist/geotiff-source-loader-types.d.ts",
|
|
304
|
+
"import": "./dist/geotiff-source-loader-types.js"
|
|
304
305
|
},
|
|
305
|
-
"./
|
|
306
|
-
"types": "./dist/
|
|
307
|
-
"import": "./dist/
|
|
306
|
+
"./ometiff-source-loader-types": {
|
|
307
|
+
"types": "./dist/ometiff-source-loader-types.d.ts",
|
|
308
|
+
"import": "./dist/ometiff-source-loader-types.js"
|
|
308
309
|
}
|
|
309
310
|
},
|
|
310
311
|
"sideEffects": false,
|
|
@@ -317,16 +318,16 @@
|
|
|
317
318
|
"third-party-licenses"
|
|
318
319
|
],
|
|
319
320
|
"scripts": {
|
|
320
|
-
"copy-libs": "mkdir -p dist/
|
|
321
|
+
"copy-libs": "mkdir -p dist/lerc/libs && cp -R src/lerc/libs/. dist/lerc/libs/",
|
|
321
322
|
"build-cjs": "node ../../node_modules/@vis.gl/dev-tools/dist/build-cjs.js",
|
|
322
323
|
"build-worker-terrain": "node ../../scripts/build-codec-worker.mjs src/terrain/workers/terrain-worker.ts --bundle --outfile=dist/terrain-worker.js --define:__VERSION__=\\\"$npm_package_version\\\"",
|
|
323
324
|
"build-worker-quantized-mesh": "node ../../scripts/build-codec-worker.mjs src/terrain/workers/quantized-mesh-worker.ts --bundle --outfile=dist/quantized-mesh-worker.js --define:__VERSION__=\\\"$npm_package_version\\\"",
|
|
324
325
|
"pre-build": "npm run copy-libs && node ./build-cjs.mjs && npm run build-worker-terrain && npm run build-worker-quantized-mesh"
|
|
325
326
|
},
|
|
326
327
|
"dependencies": {
|
|
327
|
-
"@loaders.gl/
|
|
328
|
-
"@
|
|
329
|
-
"
|
|
328
|
+
"@loaders.gl/documents": "5.0.0-beta.4",
|
|
329
|
+
"@loaders.gl/images": "5.0.0-beta.4",
|
|
330
|
+
"@math.gl/geospatial": "5.0.0-beta.4"
|
|
330
331
|
},
|
|
331
332
|
"peerDependencies": {
|
|
332
333
|
"@loaders.gl/core": "~5.0.0-alpha.0",
|
|
@@ -342,9 +343,34 @@
|
|
|
342
343
|
}
|
|
343
344
|
},
|
|
344
345
|
"devDependencies": {
|
|
345
|
-
"@mapbox/martini": "0.2.0",
|
|
346
346
|
"geotiff": "^2.1.0",
|
|
347
347
|
"lerc": "^4.2.0"
|
|
348
348
|
},
|
|
349
|
-
"
|
|
349
|
+
"keywords": [
|
|
350
|
+
"loaders.gl",
|
|
351
|
+
"GeoTIFF",
|
|
352
|
+
"TIFF",
|
|
353
|
+
"COG",
|
|
354
|
+
"OME-TIFF",
|
|
355
|
+
"LERC",
|
|
356
|
+
"LERC1",
|
|
357
|
+
"LERC2",
|
|
358
|
+
"quantized mesh",
|
|
359
|
+
"Mapbox Terrain-RGB",
|
|
360
|
+
"Terrarium",
|
|
361
|
+
"PNG",
|
|
362
|
+
"JPEG",
|
|
363
|
+
"GIF",
|
|
364
|
+
"WebP",
|
|
365
|
+
"BMP",
|
|
366
|
+
"geotif",
|
|
367
|
+
"jpg",
|
|
368
|
+
"lrc",
|
|
369
|
+
"ome.tif",
|
|
370
|
+
"ome.tiff",
|
|
371
|
+
"pngraw",
|
|
372
|
+
"terrain",
|
|
373
|
+
"tif"
|
|
374
|
+
],
|
|
375
|
+
"gitHead": "c9420f06e870fa353889d55b684e3588d24574c2"
|
|
350
376
|
}
|
|
@@ -30,7 +30,7 @@ export type GeoTIFFLoaderOptions = LoaderOptions & {
|
|
|
30
30
|
|
|
31
31
|
/** Preloads the parser-bearing GeoTIFF loader implementation. */
|
|
32
32
|
async function preload() {
|
|
33
|
-
const {GeoTIFFLoaderWithParser} = await import('@loaders.gl/raster/geotiff
|
|
33
|
+
const {GeoTIFFLoaderWithParser} = await import('@loaders.gl/raster/geotiff-loader');
|
|
34
34
|
return GeoTIFFLoaderWithParser;
|
|
35
35
|
}
|
|
36
36
|
|
|
@@ -12,9 +12,7 @@ const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';
|
|
|
12
12
|
|
|
13
13
|
/** Loads the optional numeric TIFF parser on first use by an asynchronous core API. */
|
|
14
14
|
async function preload() {
|
|
15
|
-
const {GeoTIFFRasterLoaderWithParser} = await import(
|
|
16
|
-
'@loaders.gl/raster/geotiff/geotiff-raster-loader'
|
|
17
|
-
);
|
|
15
|
+
const {GeoTIFFRasterLoaderWithParser} = await import('@loaders.gl/raster/geotiff-raster-loader');
|
|
18
16
|
return GeoTIFFRasterLoaderWithParser;
|
|
19
17
|
}
|
|
20
18
|
|
|
@@ -42,7 +42,7 @@ export const GeoTIFFSourceLoader = {
|
|
|
42
42
|
},
|
|
43
43
|
/** Loads the implementation for asynchronous source construction. */
|
|
44
44
|
preload: async () =>
|
|
45
|
-
(await import('@loaders.gl/raster/geotiff
|
|
45
|
+
(await import('@loaders.gl/raster/geotiff-source-loader')).GeoTIFFSourceLoader,
|
|
46
46
|
/** Synchronous construction requires the source implementation subpath. */
|
|
47
47
|
createDataSource(
|
|
48
48
|
_data: string | Blob,
|
|
@@ -12,6 +12,7 @@ import type {OmeTiffSelection} from './ome-indexers';
|
|
|
12
12
|
|
|
13
13
|
export const isOmeTiff = (img: GeoTIFFImage) => img.fileDirectory.ImageDescription.includes('<OME');
|
|
14
14
|
|
|
15
|
+
/** Builds OME pixel sources after removing the TIFF ASCII tag terminator. */
|
|
15
16
|
export async function loadOmeTiff(tiff: GeoTIFF, firstImage: GeoTIFFImage) {
|
|
16
17
|
// Get first image from tiff and inspect OME-XML metadata
|
|
17
18
|
const {
|
|
@@ -19,7 +20,12 @@ export async function loadOmeTiff(tiff: GeoTIFF, firstImage: GeoTIFFImage) {
|
|
|
19
20
|
SubIFDs,
|
|
20
21
|
PhotometricInterpretation: photometricInterpretation
|
|
21
22
|
} = firstImage.fileDirectory;
|
|
22
|
-
|
|
23
|
+
// TIFF ASCII counts include a terminal NUL; it is not part of the XML document.
|
|
24
|
+
let descriptionLength = ImageDescription.length;
|
|
25
|
+
while (descriptionLength > 0 && ImageDescription.charCodeAt(descriptionLength - 1) === 0) {
|
|
26
|
+
descriptionLength--;
|
|
27
|
+
}
|
|
28
|
+
const omexml = fromString(ImageDescription.slice(0, descriptionLength));
|
|
23
29
|
|
|
24
30
|
/*
|
|
25
31
|
* Image pyramids are stored differently between versions of Bioformats.
|
|
@@ -2,14 +2,15 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import {parseXMLSync} from '@loaders.gl/documents/xml-parser';
|
|
6
6
|
import {ensureArray, intToRgba} from '../utils/tiff-utils';
|
|
7
7
|
|
|
8
8
|
// WARNING: Changes to the parser options _will_ effect the types in types/omexml.d.ts.
|
|
9
|
-
const
|
|
9
|
+
const OME_XML_OPTIONS = {
|
|
10
10
|
// Nests attributes withtout prefix under 'attr' key for each node
|
|
11
11
|
attributeNamePrefix: '',
|
|
12
12
|
attributesGroupName: 'attr',
|
|
13
|
+
textNodeName: '#text',
|
|
13
14
|
|
|
14
15
|
// Parses numbers for both attributes and nodes
|
|
15
16
|
parseTagValue: true,
|
|
@@ -17,9 +18,9 @@ const xmlParser = new XMLParser({
|
|
|
17
18
|
|
|
18
19
|
// Forces attributes to be parsed
|
|
19
20
|
ignoreAttributes: false
|
|
20
|
-
}
|
|
21
|
+
};
|
|
21
22
|
|
|
22
|
-
const parse = (str: string): Root =>
|
|
23
|
+
const parse = (str: string): Root => parseXMLSync(str, OME_XML_OPTIONS);
|
|
23
24
|
|
|
24
25
|
export function fromString(str: string) {
|
|
25
26
|
const res = parse(str);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import {parseXMLSync, validateXML} from '@loaders.gl/documents/xml-parser';
|
|
6
6
|
import {UnsupportedTiffEncodingError} from './decode-tiff-samples';
|
|
7
7
|
|
|
8
8
|
/** Parses small, already-budgeted GDAL XML into explicit image and original-band records. */
|
|
@@ -18,17 +18,18 @@ export function parseTiffGDALMetadata(
|
|
|
18
18
|
const metadata: Record<string, unknown> = {};
|
|
19
19
|
const bandMetadata = Array.from({length: bandCount}, () => ({}) as Record<string, unknown>);
|
|
20
20
|
if (xml !== undefined) {
|
|
21
|
-
if (
|
|
21
|
+
if (validateXML(xml) !== true) throw new Error('Invalid TIFF GDAL XML');
|
|
22
22
|
if (/<!DOCTYPE/i.test(xml))
|
|
23
23
|
throw new UnsupportedTiffEncodingError('TIFF GDAL XML document type');
|
|
24
|
-
const parsed =
|
|
24
|
+
const parsed = parseXMLSync(xml, {
|
|
25
25
|
ignoreAttributes: false,
|
|
26
26
|
attributeNamePrefix: '',
|
|
27
27
|
parseTagValue: false,
|
|
28
28
|
parseAttributeValue: false,
|
|
29
29
|
trimValues: false,
|
|
30
|
-
processEntities: false
|
|
31
|
-
|
|
30
|
+
processEntities: false,
|
|
31
|
+
textNodeName: '#text'
|
|
32
|
+
});
|
|
32
33
|
if (
|
|
33
34
|
!Object.hasOwn(parsed, 'GDALMetadata') ||
|
|
34
35
|
(parsed.GDALMetadata !== '' && typeof parsed.GDALMetadata !== 'object')
|
|
@@ -37,7 +37,7 @@ export const OMETiffSourceLoader = {
|
|
|
37
37
|
testURL: (url: string): boolean => /\.ome\.tiff?(?:$|[?#])/i.test(url),
|
|
38
38
|
/** Loads the implementation for asynchronous source construction. */
|
|
39
39
|
preload: async () =>
|
|
40
|
-
(await import('@loaders.gl/raster/
|
|
40
|
+
(await import('@loaders.gl/raster/ometiff-source-loader')).OMETiffSourceLoader,
|
|
41
41
|
/** Synchronous construction requires the source implementation subpath. */
|
|
42
42
|
createDataSource(_data: string | Blob, _options: OMETiffSourceLoaderOptions): OMETiffImageSource {
|
|
43
43
|
throw new Error(
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './geotiff/geotiff-loader-types.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './geotiff/geotiff-loader.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './geotiff/geotiff-raster-loader-types.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './geotiff/geotiff-raster-loader.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './geotiff/geotiff-source-loader-types.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './geotiff/geotiff-source-loader.js';
|
|
@@ -25,7 +25,7 @@ export type LERCLoaderOptions = LoaderOptions & {
|
|
|
25
25
|
|
|
26
26
|
/** Preloads the parser-bearing LERC loader implementation. */
|
|
27
27
|
async function preload() {
|
|
28
|
-
const {LERCLoaderWithParser} = await import('@loaders.gl/raster/lerc
|
|
28
|
+
const {LERCLoaderWithParser} = await import('@loaders.gl/raster/lerc-loader');
|
|
29
29
|
return LERCLoaderWithParser;
|
|
30
30
|
}
|
|
31
31
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './lerc/lerc-loader-types.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './lerc/lerc-loader.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './geotiff/ometiff-source-loader-types.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './geotiff/ometiff-source-loader.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './terrain/quantized-mesh-loader-types.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './terrain/quantized-mesh-loader.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './terrain/quantized-mesh-writer.js';
|
|
@@ -4,8 +4,11 @@
|
|
|
4
4
|
|
|
5
5
|
import type {Mesh} from '@loaders.gl/core/schema';
|
|
6
6
|
import {deduceMeshSchema, getMeshBoundingBox} from '@loaders.gl/core/schema-utils';
|
|
7
|
-
import
|
|
8
|
-
|
|
7
|
+
import {
|
|
8
|
+
HeightField,
|
|
9
|
+
createMartiniTerrainMesh,
|
|
10
|
+
createDelatinTerrainMesh
|
|
11
|
+
} from '@math.gl/geospatial/terrain';
|
|
9
12
|
import {addSkirt} from './helpers/skirt';
|
|
10
13
|
import {decodeTerrainHeightmapInto} from './decode-terrain-heightmap';
|
|
11
14
|
import type {ElevationDecoder} from './terrain-heightmap-types';
|
|
@@ -13,6 +16,8 @@ import type {ElevationDecoder} from './terrain-heightmap-types';
|
|
|
13
16
|
export type TerrainOptions = {
|
|
14
17
|
/** Maximum terrain mesh error in meters. */
|
|
15
18
|
meshMaxError: number;
|
|
19
|
+
/** Maximum source-node validation tests per refinement pass; defaults scale with the padded grid. */
|
|
20
|
+
meshMaxSampleTests?: number;
|
|
16
21
|
/** Bounds used to map terrain image coordinates to x/y positions. */
|
|
17
22
|
bounds: number[];
|
|
18
23
|
/** Decoder used to convert terrain image channels to elevation values. */
|
|
@@ -43,7 +48,7 @@ export function makeTerrainMeshFromImage(
|
|
|
43
48
|
terrainImage: TerrainImage,
|
|
44
49
|
terrainOptions: TerrainOptions
|
|
45
50
|
): Mesh {
|
|
46
|
-
const {
|
|
51
|
+
const {bounds, elevationDecoder} = terrainOptions;
|
|
47
52
|
|
|
48
53
|
const {data, width, height} = terrainImage;
|
|
49
54
|
|
|
@@ -52,20 +57,20 @@ export function makeTerrainMeshFromImage(
|
|
|
52
57
|
switch (terrainOptions.tesselator) {
|
|
53
58
|
case 'martini':
|
|
54
59
|
terrain = getTerrain(data, width, height, elevationDecoder, terrainOptions.tesselator);
|
|
55
|
-
mesh =
|
|
60
|
+
mesh = getTerrainTileMesh(terrainOptions, width, height, terrain, 'martini');
|
|
56
61
|
break;
|
|
57
62
|
case 'delatin':
|
|
58
63
|
terrain = getTerrain(data, width, height, elevationDecoder, terrainOptions.tesselator);
|
|
59
|
-
mesh =
|
|
64
|
+
mesh = getTerrainTileMesh(terrainOptions, width, height, terrain, 'delatin');
|
|
60
65
|
break;
|
|
61
66
|
// auto
|
|
62
67
|
default:
|
|
63
68
|
if (width === height && !(height & (width - 1))) {
|
|
64
69
|
terrain = getTerrain(data, width, height, elevationDecoder, 'martini');
|
|
65
|
-
mesh =
|
|
70
|
+
mesh = getTerrainTileMesh(terrainOptions, width, height, terrain, 'martini');
|
|
66
71
|
} else {
|
|
67
72
|
terrain = getTerrain(data, width, height, elevationDecoder, 'delatin');
|
|
68
|
-
mesh =
|
|
73
|
+
mesh = getTerrainTileMesh(terrainOptions, width, height, terrain, 'delatin');
|
|
69
74
|
}
|
|
70
75
|
break;
|
|
71
76
|
}
|
|
@@ -112,39 +117,30 @@ export function makeTerrainMeshFromImage(
|
|
|
112
117
|
};
|
|
113
118
|
}
|
|
114
119
|
|
|
115
|
-
/**
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
* @returns {{vertices: number[], triangles: number[]}} vertices and triangles data
|
|
140
|
-
*/
|
|
141
|
-
function getDelatinTileMesh(meshMaxError, width, height, terrain) {
|
|
142
|
-
const tin = new Delatin(terrain, width + 1, height + 1);
|
|
143
|
-
tin.run(meshMaxError);
|
|
144
|
-
// @ts-expect-error
|
|
145
|
-
const {coords, triangles} = tin;
|
|
146
|
-
const vertices = coords;
|
|
147
|
-
return {vertices, triangles};
|
|
120
|
+
/** Adapts the padded, north-first image grid to upstream adaptive terrain meshing. */
|
|
121
|
+
function getTerrainTileMesh(
|
|
122
|
+
terrainOptions: TerrainOptions,
|
|
123
|
+
width: number,
|
|
124
|
+
height: number,
|
|
125
|
+
terrain: Float32Array,
|
|
126
|
+
tesselator: 'martini' | 'delatin'
|
|
127
|
+
) {
|
|
128
|
+
const field = new HeightField({
|
|
129
|
+
width: width + 1,
|
|
130
|
+
height: height + 1,
|
|
131
|
+
heights: terrain,
|
|
132
|
+
rowStep: [0, -1]
|
|
133
|
+
});
|
|
134
|
+
// Fully refined RTIN triangles can inspect 32 neighboring grid nodes per source cell.
|
|
135
|
+
const options = {
|
|
136
|
+
maxError: terrainOptions.meshMaxError,
|
|
137
|
+
maxSampleTests: terrainOptions.meshMaxSampleTests ?? Math.max(10_000_000, 32 * terrain.length)
|
|
138
|
+
};
|
|
139
|
+
const mesh =
|
|
140
|
+
tesselator === 'martini'
|
|
141
|
+
? createMartiniTerrainMesh(field, options)
|
|
142
|
+
: createDelatinTerrainMesh(field, options);
|
|
143
|
+
return {vertices: mesh.gridCoordinates, triangles: mesh.indices};
|
|
148
144
|
}
|
|
149
145
|
|
|
150
146
|
function getTerrain(
|
|
@@ -32,8 +32,7 @@ export const QuantizedMeshLoader = {
|
|
|
32
32
|
worker: true,
|
|
33
33
|
/** Loads the parser-bearing quantized mesh loader implementation. */
|
|
34
34
|
preload: async () =>
|
|
35
|
-
(await import('@loaders.gl/raster/
|
|
36
|
-
.QuantizedMeshLoaderWithParser,
|
|
35
|
+
(await import('@loaders.gl/raster/quantized-mesh-loader')).QuantizedMeshLoaderWithParser,
|
|
37
36
|
options: {
|
|
38
37
|
'quantized-mesh': {
|
|
39
38
|
shape: 'arrow-table',
|
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
|
|
5
5
|
import type {Loader} from '@loaders.gl/core/loader-utils';
|
|
6
6
|
import type {Mesh, MeshArrowTable} from '@loaders.gl/core/schema';
|
|
7
|
-
import type {
|
|
7
|
+
import type {ImageLoaderOptions} from '@loaders.gl/images';
|
|
8
8
|
import {VERSION} from './lib/utils/version';
|
|
9
9
|
|
|
10
10
|
import type {TerrainOptions} from './lib/parse-terrain';
|
|
11
11
|
import {TerrainFormat} from './terrain-format';
|
|
12
12
|
|
|
13
13
|
/** TerrainLoader options */
|
|
14
|
-
export type TerrainLoaderOptions =
|
|
14
|
+
export type TerrainLoaderOptions = ImageLoaderOptions & {
|
|
15
15
|
/** TerrainLoader options */
|
|
16
16
|
terrain?: TerrainOptions & {
|
|
17
17
|
/** Selects mesh output or Apache Arrow output. */
|
|
@@ -32,8 +32,7 @@ export const TerrainLoader = {
|
|
|
32
32
|
version: VERSION,
|
|
33
33
|
worker: true,
|
|
34
34
|
/** Loads the parser-bearing terrain loader implementation. */
|
|
35
|
-
preload: async () =>
|
|
36
|
-
(await import('@loaders.gl/raster/terrain/terrain-loader')).TerrainLoaderWithParser,
|
|
35
|
+
preload: async () => (await import('@loaders.gl/raster/terrain-loader')).TerrainLoaderWithParser,
|
|
37
36
|
options: {
|
|
38
37
|
terrain: {
|
|
39
38
|
tesselator: 'auto',
|
|
@@ -10,7 +10,7 @@ import type {LoaderContext, LoaderWithParser} from '@loaders.gl/core/loader-util
|
|
|
10
10
|
import {parseFromContext} from '@loaders.gl/core/loader-utils';
|
|
11
11
|
import type {Mesh, MeshArrowTable} from '@loaders.gl/core/schema';
|
|
12
12
|
import {convertMeshToTable, convertTableToMesh} from '@loaders.gl/core/schema-utils';
|
|
13
|
-
import {
|
|
13
|
+
import {ImageLoader, getImageData} from '@loaders.gl/images';
|
|
14
14
|
import {TerrainOptions, makeTerrainMeshFromImage} from './lib/parse-terrain';
|
|
15
15
|
import {
|
|
16
16
|
TerrainLoader as TerrainLoaderMetadata,
|
|
@@ -28,7 +28,7 @@ export const TerrainLoaderWithParser = {
|
|
|
28
28
|
serializeWorkerResult: serializeArrowWorkerResult,
|
|
29
29
|
deserializeWorkerResult: deserializeArrowWorkerResult,
|
|
30
30
|
/** Image decoder requested by terrain workers through the nested parse bridge. */
|
|
31
|
-
subloaders: {
|
|
31
|
+
subloaders: {ImageLoader},
|
|
32
32
|
parse: parseTerrain
|
|
33
33
|
} as const satisfies LoaderWithParser<Mesh | MeshArrowTable, never, TerrainLoaderOptions>;
|
|
34
34
|
|
|
@@ -48,7 +48,7 @@ export async function parseTerrain(
|
|
|
48
48
|
...options,
|
|
49
49
|
core: {...options?.core, mimeType: 'application/x.image'}
|
|
50
50
|
};
|
|
51
|
-
const image = await parseFromContext(arrayBuffer,
|
|
51
|
+
const image = await parseFromContext(arrayBuffer, ImageLoader, loadImageOptions, context!);
|
|
52
52
|
const imageData = getImageData(image);
|
|
53
53
|
const terrainImage = {
|
|
54
54
|
width: imageData.width,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './terrain/terrain-loader-types.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './terrain/terrain-loader.js';
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
# Martini
|
|
2
|
-
|
|
3
|
-
martini.mjs is copied unchanged from the ISC-licensed @mapbox/martini 0.2.0
|
|
4
|
-
package. See martini-LICENSE. Upstream: https://github.com/mapbox/martini/tree/v0.2.0
|
|
5
|
-
|
|
6
|
-
SHA-256: 4df72465a6d168d419ad41593bbeea72025f0be083b01ce16372b071e316430c
|
|
7
|
-
|
|
8
|
-
Retain the pinned development dependency for source verification when updating.
|
|
9
|
-
The existing vendored-library coverage exclusion applies; terrain adapter tests
|
|
10
|
-
exercise mesh generation through this implementation.
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
ISC License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2019, Mapbox
|
|
4
|
-
|
|
5
|
-
Permission to use, copy, modify, and/or distribute this software for any purpose
|
|
6
|
-
with or without fee is hereby granted, provided that the above copyright notice
|
|
7
|
-
and this permission notice appear in all copies.
|
|
8
|
-
|
|
9
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
10
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
11
|
-
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
12
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
|
13
|
-
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
|
14
|
-
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
|
15
|
-
THIS SOFTWARE.
|