@developmentseed/deck.gl-geotiff 0.2.0 → 0.3.0
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 +33 -4
- package/dist/cog-layer.d.ts +63 -57
- package/dist/cog-layer.d.ts.map +1 -1
- package/dist/cog-layer.js +116 -85
- package/dist/cog-layer.js.map +1 -1
- package/dist/geotiff/geotiff.d.ts +5 -43
- package/dist/geotiff/geotiff.d.ts.map +1 -1
- package/dist/geotiff/geotiff.js +34 -103
- package/dist/geotiff/geotiff.js.map +1 -1
- package/dist/geotiff/render-pipeline.d.ts +7 -5
- package/dist/geotiff/render-pipeline.d.ts.map +1 -1
- package/dist/geotiff/render-pipeline.js +152 -49
- package/dist/geotiff/render-pipeline.js.map +1 -1
- package/dist/geotiff/texture.d.ts +5 -4
- package/dist/geotiff/texture.d.ts.map +1 -1
- package/dist/geotiff/texture.js +7 -7
- package/dist/geotiff/texture.js.map +1 -1
- package/dist/geotiff-layer.d.ts +21 -24
- package/dist/geotiff-layer.d.ts.map +1 -1
- package/dist/geotiff-layer.js +25 -21
- package/dist/geotiff-layer.js.map +1 -1
- package/dist/geotiff-reprojection.d.ts +5 -18
- package/dist/geotiff-reprojection.d.ts.map +1 -1
- package/dist/geotiff-reprojection.js +9 -126
- package/dist/geotiff-reprojection.js.map +1 -1
- package/dist/index.d.ts +3 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -7
- package/dist/index.js.map +1 -1
- package/dist/proj.d.ts +3 -23
- package/dist/proj.d.ts.map +1 -1
- package/dist/proj.js +20 -38
- package/dist/proj.js.map +1 -1
- package/package.json +16 -12
- package/dist/cog-tile-matrix-set.d.ts +0 -32
- package/dist/cog-tile-matrix-set.d.ts.map +0 -1
- package/dist/cog-tile-matrix-set.js +0 -180
- package/dist/cog-tile-matrix-set.js.map +0 -1
- package/dist/ellipsoids.d.ts +0 -153
- package/dist/ellipsoids.d.ts.map +0 -1
- package/dist/ellipsoids.js +0 -153
- package/dist/ellipsoids.js.map +0 -1
- package/dist/geotiff/types.d.ts +0 -34
- package/dist/geotiff/types.d.ts.map +0 -1
- package/dist/geotiff/types.js +0 -18
- package/dist/geotiff/types.js.map +0 -1
|
@@ -1,59 +1,21 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import {
|
|
1
|
+
import type { RasterArray } from "@developmentseed/geotiff";
|
|
2
|
+
import { GeoTIFF } from "@developmentseed/geotiff";
|
|
3
3
|
import type { Converter } from "proj4";
|
|
4
|
-
/**
|
|
5
|
-
* Options that may be passed when reading image data from geotiff.js
|
|
6
|
-
*/
|
|
7
|
-
type ReadRasterOptions = {
|
|
8
|
-
/** the subset to read data from in pixels. */
|
|
9
|
-
window?: [number, number, number, number];
|
|
10
|
-
/** The optional decoder pool to use. */
|
|
11
|
-
pool?: Pool;
|
|
12
|
-
/** An AbortSignal that may be signalled if the request is to be aborted */
|
|
13
|
-
signal?: AbortSignal;
|
|
14
|
-
};
|
|
15
|
-
/**
|
|
16
|
-
* Retrieve the default geotiff.js decoder Pool.
|
|
17
|
-
*
|
|
18
|
-
* If a Pool has not yet been created, it will be created on first call.
|
|
19
|
-
*
|
|
20
|
-
* The Pool will be shared between all COGLayer and GeoTIFFLayer instances.
|
|
21
|
-
*/
|
|
22
|
-
export declare function defaultPool(): Pool;
|
|
23
|
-
/**
|
|
24
|
-
* Load an RGBA image from a GeoTIFFImage.
|
|
25
|
-
*/
|
|
26
|
-
export declare function loadRgbImage(image: GeoTIFFImage, options?: ReadRasterOptions): Promise<{
|
|
27
|
-
texture: ImageData;
|
|
28
|
-
height: number;
|
|
29
|
-
width: number;
|
|
30
|
-
}>;
|
|
31
4
|
/**
|
|
32
5
|
* Add an alpha channel to an RGB image array.
|
|
33
6
|
*
|
|
34
7
|
* Only supports input arrays with 3 (RGB) or 4 (RGBA) channels. If the input is
|
|
35
8
|
* already RGBA, it is returned unchanged.
|
|
36
9
|
*/
|
|
37
|
-
export declare function addAlphaChannel(rgbImage:
|
|
38
|
-
|
|
39
|
-
* Parse the GeoTIFF `ColorMap` tag into an ImageData.
|
|
40
|
-
*
|
|
41
|
-
* @param {Uint16Array} cmap The colormap array from the GeoTIFF `ColorMap` tag.
|
|
42
|
-
*
|
|
43
|
-
* @return {ImageData} The parsed colormap as an ImageData object.
|
|
44
|
-
*/
|
|
45
|
-
export declare function parseColormap(cmap: Uint16Array): ImageData;
|
|
46
|
-
export declare function fetchGeoTIFF(input: GeoTIFF | string | ArrayBuffer | Blob | BaseClient): Promise<GeoTIFF>;
|
|
10
|
+
export declare function addAlphaChannel(rgbImage: RasterArray): RasterArray;
|
|
11
|
+
export declare function fetchGeoTIFF(input: GeoTIFF | string | URL | ArrayBuffer): Promise<GeoTIFF>;
|
|
47
12
|
/**
|
|
48
13
|
* Calculate the WGS84 bounding box of a GeoTIFF image
|
|
49
14
|
*/
|
|
50
|
-
export declare function getGeographicBounds(
|
|
15
|
+
export declare function getGeographicBounds(geotiff: GeoTIFF, converter: Converter): {
|
|
51
16
|
west: number;
|
|
52
17
|
south: number;
|
|
53
18
|
east: number;
|
|
54
19
|
north: number;
|
|
55
20
|
};
|
|
56
|
-
/** Parse the GDAL_NODATA TIFF tag into a number. */
|
|
57
|
-
export declare function parseGDALNoData(GDAL_NODATA: string | undefined): number | null;
|
|
58
|
-
export {};
|
|
59
21
|
//# sourceMappingURL=geotiff.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geotiff.d.ts","sourceRoot":"","sources":["../../src/geotiff/geotiff.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"geotiff.d.ts","sourceRoot":"","sources":["../../src/geotiff/geotiff.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,WAAW,GAAG,WAAW,CAwClE;AAED,wBAAsB,YAAY,CAChC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,GAAG,GAAG,WAAW,GAC1C,OAAO,CAAC,OAAO,CAAC,CAUlB;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,SAAS,GACnB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAsB9D"}
|
package/dist/geotiff/geotiff.js
CHANGED
|
@@ -1,44 +1,5 @@
|
|
|
1
|
-
// Utilities for interacting with
|
|
2
|
-
import {
|
|
3
|
-
/**
|
|
4
|
-
* A default geotiff.js decoder pool instance.
|
|
5
|
-
*
|
|
6
|
-
* It will be created on first call of `defaultPool`.
|
|
7
|
-
*/
|
|
8
|
-
let DEFAULT_POOL = null;
|
|
9
|
-
/**
|
|
10
|
-
* Retrieve the default geotiff.js decoder Pool.
|
|
11
|
-
*
|
|
12
|
-
* If a Pool has not yet been created, it will be created on first call.
|
|
13
|
-
*
|
|
14
|
-
* The Pool will be shared between all COGLayer and GeoTIFFLayer instances.
|
|
15
|
-
*/
|
|
16
|
-
export function defaultPool() {
|
|
17
|
-
if (DEFAULT_POOL === null) {
|
|
18
|
-
DEFAULT_POOL = new Pool();
|
|
19
|
-
}
|
|
20
|
-
return DEFAULT_POOL;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Load an RGBA image from a GeoTIFFImage.
|
|
24
|
-
*/
|
|
25
|
-
export async function loadRgbImage(image, options) {
|
|
26
|
-
const mergedOptions = {
|
|
27
|
-
...options,
|
|
28
|
-
interleave: true,
|
|
29
|
-
enableAlpha: true,
|
|
30
|
-
};
|
|
31
|
-
// Since we set interleave: true, the result is a single array with all
|
|
32
|
-
// samples, so we cast to TypedArrayWithDimensions
|
|
33
|
-
// https://github.com/geotiffjs/geotiff.js/issues/486
|
|
34
|
-
const rgbImage = (await image.readRGB(mergedOptions));
|
|
35
|
-
const imageData = addAlphaChannel(rgbImage);
|
|
36
|
-
return {
|
|
37
|
-
texture: imageData,
|
|
38
|
-
height: rgbImage.height,
|
|
39
|
-
width: rgbImage.width,
|
|
40
|
-
};
|
|
41
|
-
}
|
|
1
|
+
// Utilities for interacting with a GeoTIFF
|
|
2
|
+
import { GeoTIFF } from "@developmentseed/geotiff";
|
|
42
3
|
/**
|
|
43
4
|
* Add an alpha channel to an RGB image array.
|
|
44
5
|
*
|
|
@@ -47,75 +8,56 @@ export async function loadRgbImage(image, options) {
|
|
|
47
8
|
*/
|
|
48
9
|
export function addAlphaChannel(rgbImage) {
|
|
49
10
|
const { height, width } = rgbImage;
|
|
50
|
-
if (rgbImage.
|
|
11
|
+
if (rgbImage.layout === "band-separate") {
|
|
12
|
+
// This should be pretty easy to do by just returning an additional array of
|
|
13
|
+
// 255s
|
|
14
|
+
// But not sure if we'll want to do that, because it's fine to upload 3
|
|
15
|
+
// separate textures.
|
|
16
|
+
throw new Error("Band-separate images not yet implemented.");
|
|
17
|
+
}
|
|
18
|
+
if (rgbImage.data.length === height * width * 4) {
|
|
51
19
|
// Already has alpha channel
|
|
52
|
-
return
|
|
20
|
+
return rgbImage;
|
|
53
21
|
}
|
|
54
|
-
else if (rgbImage.length === height * width * 3) {
|
|
22
|
+
else if (rgbImage.data.length === height * width * 3) {
|
|
55
23
|
// Need to add alpha channel
|
|
56
|
-
const rgbaLength = (rgbImage.length / 3) * 4;
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
24
|
+
const rgbaLength = (rgbImage.data.length / 3) * 4;
|
|
25
|
+
const isUint16 = rgbImage.data instanceof Uint16Array;
|
|
26
|
+
const rgbaArray = isUint16
|
|
27
|
+
? new Uint16Array(rgbaLength)
|
|
28
|
+
: new Uint8ClampedArray(rgbaLength);
|
|
29
|
+
const maxAlpha = isUint16 ? 65535 : 255;
|
|
30
|
+
for (let i = 0; i < rgbImage.data.length / 3; ++i) {
|
|
31
|
+
rgbaArray[i * 4] = rgbImage.data[i * 3];
|
|
32
|
+
rgbaArray[i * 4 + 1] = rgbImage.data[i * 3 + 1];
|
|
33
|
+
rgbaArray[i * 4 + 2] = rgbImage.data[i * 3 + 2];
|
|
34
|
+
rgbaArray[i * 4 + 3] = maxAlpha;
|
|
63
35
|
}
|
|
64
|
-
return
|
|
36
|
+
return {
|
|
37
|
+
...rgbImage,
|
|
38
|
+
count: 4,
|
|
39
|
+
data: rgbaArray,
|
|
40
|
+
};
|
|
65
41
|
}
|
|
66
42
|
else {
|
|
67
|
-
throw new Error(`Unexpected number of channels in raster data: ${rgbImage.length / (height * width)}`);
|
|
43
|
+
throw new Error(`Unexpected number of channels in raster data: ${rgbImage.data.length / (height * width)}`);
|
|
68
44
|
}
|
|
69
45
|
}
|
|
70
|
-
/**
|
|
71
|
-
* Parse the GeoTIFF `ColorMap` tag into an ImageData.
|
|
72
|
-
*
|
|
73
|
-
* @param {Uint16Array} cmap The colormap array from the GeoTIFF `ColorMap` tag.
|
|
74
|
-
*
|
|
75
|
-
* @return {ImageData} The parsed colormap as an ImageData object.
|
|
76
|
-
*/
|
|
77
|
-
export function parseColormap(cmap) {
|
|
78
|
-
// TODO: test colormap handling on a 16-bit image with 2^16 entries?
|
|
79
|
-
const size = cmap.length / 3;
|
|
80
|
-
const rgba = new Uint8ClampedArray(size * 4);
|
|
81
|
-
const rOffset = 0;
|
|
82
|
-
const gOffset = size;
|
|
83
|
-
const bOffset = size * 2;
|
|
84
|
-
// Note: >> 8 is needed to convert from 16-bit to 8-bit color values
|
|
85
|
-
// It just divides by 256 and floors to nearest integer
|
|
86
|
-
for (let i = 0; i < size; i++) {
|
|
87
|
-
rgba[4 * i + 0] = cmap[rOffset + i] >> 8;
|
|
88
|
-
rgba[4 * i + 1] = cmap[gOffset + i] >> 8;
|
|
89
|
-
rgba[4 * i + 2] = cmap[bOffset + i] >> 8;
|
|
90
|
-
// Full opacity
|
|
91
|
-
rgba[4 * i + 3] = 255;
|
|
92
|
-
}
|
|
93
|
-
return new ImageData(rgba, size, 1);
|
|
94
|
-
}
|
|
95
46
|
export async function fetchGeoTIFF(input) {
|
|
96
|
-
if (typeof input === "string") {
|
|
97
|
-
return fromUrl(input);
|
|
47
|
+
if (typeof input === "string" || input instanceof URL) {
|
|
48
|
+
return await GeoTIFF.fromUrl(input);
|
|
98
49
|
}
|
|
99
50
|
if (input instanceof ArrayBuffer) {
|
|
100
|
-
return fromArrayBuffer(input);
|
|
101
|
-
}
|
|
102
|
-
if (input instanceof Blob) {
|
|
103
|
-
return fromBlob(input);
|
|
104
|
-
}
|
|
105
|
-
// TODO: instanceof may fail here if multiple versions of geotiff.js are
|
|
106
|
-
// present
|
|
107
|
-
if (input instanceof BaseClient) {
|
|
108
|
-
return fromCustomClient(input);
|
|
51
|
+
return await GeoTIFF.fromArrayBuffer(input);
|
|
109
52
|
}
|
|
110
53
|
return input;
|
|
111
54
|
}
|
|
112
55
|
/**
|
|
113
56
|
* Calculate the WGS84 bounding box of a GeoTIFF image
|
|
114
57
|
*/
|
|
115
|
-
export function getGeographicBounds(
|
|
116
|
-
const
|
|
58
|
+
export function getGeographicBounds(geotiff, converter) {
|
|
59
|
+
const [minX, minY, maxX, maxY] = geotiff.bbox;
|
|
117
60
|
// Reproject all four corners to handle rotation/skew
|
|
118
|
-
const [minX, minY, maxX, maxY] = projectedBbox;
|
|
119
61
|
const corners = [
|
|
120
62
|
converter.forward([minX, minY]), // bottom-left
|
|
121
63
|
converter.forward([maxX, minY]), // bottom-right
|
|
@@ -132,15 +74,4 @@ export function getGeographicBounds(image, converter) {
|
|
|
132
74
|
// Return bounds in MapLibre format: [[west, south], [east, north]]
|
|
133
75
|
return { west, south, east, north };
|
|
134
76
|
}
|
|
135
|
-
/** Parse the GDAL_NODATA TIFF tag into a number. */
|
|
136
|
-
export function parseGDALNoData(GDAL_NODATA) {
|
|
137
|
-
if (!GDAL_NODATA) {
|
|
138
|
-
return null;
|
|
139
|
-
}
|
|
140
|
-
// Remove trailing null character if present
|
|
141
|
-
const noDataString = GDAL_NODATA?.[GDAL_NODATA?.length - 1] === "\x00"
|
|
142
|
-
? GDAL_NODATA.slice(0, -1)
|
|
143
|
-
: GDAL_NODATA;
|
|
144
|
-
return noDataString?.length > 0 ? parseFloat(noDataString) : null;
|
|
145
|
-
}
|
|
146
77
|
//# sourceMappingURL=geotiff.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geotiff.js","sourceRoot":"","sources":["../../src/geotiff/geotiff.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"geotiff.js","sourceRoot":"","sources":["../../src/geotiff/geotiff.ts"],"names":[],"mappings":"AAAA,2CAA2C;AAG3C,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAGnD;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,QAAqB;IACnD,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,QAAQ,CAAC;IAEnC,IAAI,QAAQ,CAAC,MAAM,KAAK,eAAe,EAAE,CAAC;QACxC,4EAA4E;QAC5E,OAAO;QACP,uEAAuE;QACvE,qBAAqB;QACrB,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;IAC/D,CAAC;IAED,IAAI,QAAQ,CAAC,IAAI,CAAC,MAAM,KAAK,MAAM,GAAG,KAAK,GAAG,CAAC,EAAE,CAAC;QAChD,4BAA4B;QAC5B,OAAO,QAAQ,CAAC;IAClB,CAAC;SAAM,IAAI,QAAQ,CAAC,IAAI,CAAC,MAAM,KAAK,MAAM,GAAG,KAAK,GAAG,CAAC,EAAE,CAAC;QACvD,4BAA4B;QAE5B,MAAM,UAAU,GAAG,CA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I,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC;IAC/B,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC;IAEhC,mEAAmE;IACnE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;AACtC,CAAC"}
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
+
import type { RasterModule } from "@developmentseed/deck.gl-raster/gpu-modules";
|
|
2
|
+
import type { GeoTIFF, Overview } from "@developmentseed/geotiff";
|
|
1
3
|
import type { Device, Texture } from "@luma.gl/core";
|
|
2
|
-
import type {
|
|
3
|
-
import type { ImageFileDirectory } from "./types";
|
|
4
|
+
import type { GetTileDataOptions } from "../cog-layer";
|
|
4
5
|
export type TextureDataT = {
|
|
5
6
|
height: number;
|
|
6
7
|
width: number;
|
|
7
8
|
texture: Texture;
|
|
9
|
+
mask?: Texture;
|
|
8
10
|
};
|
|
9
|
-
export declare function inferRenderPipeline(
|
|
10
|
-
getTileData:
|
|
11
|
-
renderTile:
|
|
11
|
+
export declare function inferRenderPipeline(geotiff: GeoTIFF, device: Device): {
|
|
12
|
+
getTileData: (image: GeoTIFF | Overview, options: GetTileDataOptions) => Promise<TextureDataT>;
|
|
13
|
+
renderTile: (data: TextureDataT) => ImageData | RasterModule[];
|
|
12
14
|
};
|
|
13
15
|
//# sourceMappingURL=render-pipeline.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render-pipeline.d.ts","sourceRoot":"","sources":["../../src/geotiff/render-pipeline.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"render-pipeline.d.ts","sourceRoot":"","sources":["../../src/geotiff/render-pipeline.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6CAA6C,CAAC;AAWhF,OAAO,KAAK,EACV,OAAO,EACP,QAAQ,EAET,MAAM,0BAA0B,CAAC;AAElC,OAAO,KAAK,EAAE,MAAM,EAAgB,OAAO,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAIvD,MAAM,MAAM,YAAY,GAAG;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,CAAC;AAqBF,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,MAAM,GACb;IACD,WAAW,EAAE,CACX,KAAK,EAAE,OAAO,GAAG,QAAQ,EACzB,OAAO,EAAE,kBAAkB,KACxB,OAAO,CAAC,YAAY,CAAC,CAAC;IAC3B,UAAU,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,SAAS,GAAG,YAAY,EAAE,CAAC;CAChE,CAeA"}
|
|
@@ -1,23 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Photometric, SampleFormat } from "@cogeotiff/core";
|
|
2
|
+
import { BlackIsZero, CMYKToRGB, Colormap, CreateTexture, cieLabToRGB, FilterNoDataVal, MaskTexture, WhiteIsZero, } from "@developmentseed/deck.gl-raster/gpu-modules";
|
|
3
|
+
import { parseColormap } from "@developmentseed/geotiff";
|
|
4
|
+
import { addAlphaChannel } from "./geotiff";
|
|
3
5
|
import { inferTextureFormat } from "./texture";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
switch (
|
|
6
|
+
export function inferRenderPipeline(geotiff, device) {
|
|
7
|
+
const { sampleFormat } = geotiff.cachedTags;
|
|
8
|
+
if (sampleFormat === null) {
|
|
9
|
+
throw new Error("SampleFormat tag is required to infer render pipeline");
|
|
10
|
+
}
|
|
11
|
+
switch (sampleFormat[0]) {
|
|
10
12
|
// Unsigned integers
|
|
11
|
-
case
|
|
12
|
-
return createUnormPipeline(
|
|
13
|
+
case SampleFormat.Uint:
|
|
14
|
+
return createUnormPipeline(geotiff, device);
|
|
13
15
|
}
|
|
14
|
-
throw new Error(`Inferring render pipeline for non-unsigned integers not yet supported. Found SampleFormat: ${
|
|
16
|
+
throw new Error(`Inferring render pipeline for non-unsigned integers not yet supported. Found SampleFormat: ${sampleFormat}`);
|
|
15
17
|
}
|
|
16
18
|
/**
|
|
17
19
|
* Create pipeline for visualizing unsigned-integer data.
|
|
18
20
|
*/
|
|
19
|
-
function createUnormPipeline(
|
|
20
|
-
const {
|
|
21
|
+
function createUnormPipeline(geotiff, device) {
|
|
22
|
+
const { bitsPerSample, colorMap, photometric, sampleFormat, samplesPerPixel, nodata, } = geotiff.cachedTags;
|
|
21
23
|
const renderPipeline = [
|
|
22
24
|
{
|
|
23
25
|
module: CreateTexture,
|
|
@@ -26,22 +28,35 @@ function createUnormPipeline(ifd, device) {
|
|
|
26
28
|
},
|
|
27
29
|
},
|
|
28
30
|
];
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
const noDataScaled = noDataVal / 255.0;
|
|
31
|
+
if (nodata !== null) {
|
|
32
|
+
// Since values are 0-1 for unorm textures, scale nodata to [0, 1]
|
|
33
|
+
const maxVal = 2 ** bitsPerSample[0] - 1;
|
|
34
|
+
const noDataScaled = nodata / maxVal;
|
|
34
35
|
renderPipeline.push({
|
|
35
36
|
module: FilterNoDataVal,
|
|
36
37
|
props: { value: noDataScaled },
|
|
37
38
|
});
|
|
38
39
|
}
|
|
39
|
-
|
|
40
|
+
if (geotiff.maskImage !== null) {
|
|
41
|
+
renderPipeline.push({
|
|
42
|
+
module: MaskTexture,
|
|
43
|
+
props: {
|
|
44
|
+
// TODO: how to handle if mask failed to load and is undefined here
|
|
45
|
+
maskTexture: (data) => data.mask,
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
const toRGBModule = photometricInterpretationToRGB({
|
|
50
|
+
count: samplesPerPixel,
|
|
51
|
+
photometric,
|
|
52
|
+
device,
|
|
53
|
+
colorMap,
|
|
54
|
+
});
|
|
40
55
|
if (toRGBModule) {
|
|
41
56
|
renderPipeline.push(toRGBModule);
|
|
42
57
|
}
|
|
43
58
|
// For palette images, use nearest-neighbor sampling
|
|
44
|
-
const samplerOptions =
|
|
59
|
+
const samplerOptions = photometric === Photometric.Palette
|
|
45
60
|
? {
|
|
46
61
|
magFilter: "nearest",
|
|
47
62
|
minFilter: "nearest",
|
|
@@ -51,32 +66,60 @@ function createUnormPipeline(ifd, device) {
|
|
|
51
66
|
minFilter: "linear",
|
|
52
67
|
};
|
|
53
68
|
const getTileData = async (image, options) => {
|
|
54
|
-
const { device } = options;
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
let
|
|
61
|
-
|
|
69
|
+
const { device, x, y, signal, pool } = options;
|
|
70
|
+
const tile = await image.fetchTile(x, y, {
|
|
71
|
+
boundless: false,
|
|
72
|
+
pool,
|
|
73
|
+
signal,
|
|
74
|
+
});
|
|
75
|
+
let { array } = tile;
|
|
76
|
+
const { width, height, mask } = array;
|
|
77
|
+
let numSamples = samplesPerPixel;
|
|
78
|
+
if (samplesPerPixel === 3) {
|
|
62
79
|
// WebGL2 doesn't have an RGB-only texture format; it requires RGBA.
|
|
63
|
-
|
|
80
|
+
array = addAlphaChannel(array);
|
|
64
81
|
numSamples = 4;
|
|
65
82
|
}
|
|
83
|
+
if (array.layout === "band-separate") {
|
|
84
|
+
throw new Error("Band-separate images not yet implemented.");
|
|
85
|
+
}
|
|
66
86
|
const textureFormat = inferTextureFormat(
|
|
67
87
|
// Add one sample for added alpha channel
|
|
68
|
-
numSamples,
|
|
88
|
+
numSamples, bitsPerSample, sampleFormat);
|
|
89
|
+
const bytesPerPixel = (bitsPerSample[0] / 8) * numSamples;
|
|
90
|
+
const textureData = enforceAlignment(array.data, {
|
|
91
|
+
width,
|
|
92
|
+
height,
|
|
93
|
+
bytesPerPixel,
|
|
94
|
+
});
|
|
69
95
|
const texture = device.createTexture({
|
|
70
|
-
data,
|
|
96
|
+
data: textureData,
|
|
71
97
|
format: textureFormat,
|
|
72
|
-
width
|
|
73
|
-
height
|
|
74
|
-
|
|
98
|
+
width,
|
|
99
|
+
height,
|
|
100
|
+
// Use nearest filtering for the mask to avoid interpolated edges/halos
|
|
101
|
+
sampler: {
|
|
102
|
+
minFilter: "nearest",
|
|
103
|
+
magFilter: "nearest",
|
|
104
|
+
},
|
|
75
105
|
});
|
|
106
|
+
let maskTexture;
|
|
107
|
+
if (mask !== null) {
|
|
108
|
+
maskTexture = device.createTexture({
|
|
109
|
+
// Mask is single-channel 8-bit, so bytesPerPixel must be 1
|
|
110
|
+
data: padToAlignment(mask, width, height, 1),
|
|
111
|
+
// Single-channel 8-bit texture for the mask
|
|
112
|
+
format: "r8unorm",
|
|
113
|
+
width,
|
|
114
|
+
height,
|
|
115
|
+
sampler: samplerOptions,
|
|
116
|
+
});
|
|
117
|
+
}
|
|
76
118
|
return {
|
|
77
119
|
texture,
|
|
78
|
-
|
|
79
|
-
|
|
120
|
+
mask: maskTexture,
|
|
121
|
+
height: array.height,
|
|
122
|
+
width: array.width,
|
|
80
123
|
};
|
|
81
124
|
};
|
|
82
125
|
const renderTile = (tileData) => {
|
|
@@ -84,15 +127,29 @@ function createUnormPipeline(ifd, device) {
|
|
|
84
127
|
};
|
|
85
128
|
return { getTileData, renderTile };
|
|
86
129
|
}
|
|
87
|
-
function photometricInterpretationToRGB(
|
|
88
|
-
|
|
89
|
-
|
|
130
|
+
function photometricInterpretationToRGB({ count, colorMap, device, photometric, }) {
|
|
131
|
+
if (count === 3 || count === 4) {
|
|
132
|
+
// Always interpret 3-band or 4-band images as RGB/RGBA
|
|
133
|
+
return null;
|
|
134
|
+
}
|
|
135
|
+
switch (photometric) {
|
|
136
|
+
case Photometric.MinIsWhite: {
|
|
137
|
+
return {
|
|
138
|
+
module: WhiteIsZero,
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
case Photometric.MinIsBlack: {
|
|
142
|
+
return {
|
|
143
|
+
module: BlackIsZero,
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
case Photometric.Rgb:
|
|
90
147
|
return null;
|
|
91
|
-
case
|
|
92
|
-
if (!
|
|
148
|
+
case Photometric.Palette: {
|
|
149
|
+
if (!colorMap) {
|
|
93
150
|
throw new Error("ColorMap is required for PhotometricInterpretation Palette");
|
|
94
151
|
}
|
|
95
|
-
const { data, width, height } = parseColormap(
|
|
152
|
+
const { data, width, height } = parseColormap(colorMap);
|
|
96
153
|
const cmapTexture = device.createTexture({
|
|
97
154
|
data,
|
|
98
155
|
format: "rgba8unorm",
|
|
@@ -112,20 +169,22 @@ function photometricInterpretationToRGB(PhotometricInterpretation, device, Color
|
|
|
112
169
|
},
|
|
113
170
|
};
|
|
114
171
|
}
|
|
115
|
-
|
|
172
|
+
// Not sure why cogeotiff calls this "Separated", but it means CMYK
|
|
173
|
+
case Photometric.Separated:
|
|
116
174
|
return {
|
|
117
175
|
module: CMYKToRGB,
|
|
118
176
|
};
|
|
119
|
-
case
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
177
|
+
case Photometric.Ycbcr:
|
|
178
|
+
// @developmentseed/geotiff currently uses canvas to parse JPEG-compressed
|
|
179
|
+
// YCbCr images, which means the YCbCr->RGB conversion is already done by
|
|
180
|
+
// the browser's image decoder
|
|
181
|
+
return null;
|
|
182
|
+
case Photometric.Cielab:
|
|
124
183
|
return {
|
|
125
184
|
module: cieLabToRGB,
|
|
126
185
|
};
|
|
127
186
|
default:
|
|
128
|
-
throw new Error(`Unsupported PhotometricInterpretation ${
|
|
187
|
+
throw new Error(`Unsupported PhotometricInterpretation ${photometric}`);
|
|
129
188
|
}
|
|
130
189
|
}
|
|
131
190
|
/**
|
|
@@ -146,4 +205,48 @@ function resolveModule(m, data) {
|
|
|
146
205
|
}
|
|
147
206
|
return { module, props: resolvedProps };
|
|
148
207
|
}
|
|
208
|
+
/**
|
|
209
|
+
* WebGL's default `UNPACK_ALIGNMENT` is 4, meaning each row of pixel data must
|
|
210
|
+
* start on a 4-byte boundary.
|
|
211
|
+
*
|
|
212
|
+
* For all array types, we must match our typed array type to what WebGL
|
|
213
|
+
* expects, so this must return the same array type as what was passed in.
|
|
214
|
+
*/
|
|
215
|
+
function enforceAlignment(data, { width, height, bytesPerPixel, }) {
|
|
216
|
+
return data instanceof Uint8Array ||
|
|
217
|
+
data instanceof Int8Array ||
|
|
218
|
+
data instanceof Uint16Array ||
|
|
219
|
+
data instanceof Int16Array
|
|
220
|
+
? padToAlignment(data, width, height, bytesPerPixel)
|
|
221
|
+
: data;
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* WebGL's default `UNPACK_ALIGNMENT` is 4, meaning each row of pixel data must
|
|
225
|
+
* start on a 4-byte boundary.
|
|
226
|
+
*
|
|
227
|
+
* For 8-bit and 16-bit data, rows may not be 4-byte aligned. For 32-bit+ data,
|
|
228
|
+
* each element is already 4 bytes so rows are always aligned.
|
|
229
|
+
*
|
|
230
|
+
* Returns the original array unchanged when no padding is needed.
|
|
231
|
+
*/
|
|
232
|
+
function padToAlignment(data, width, height, bytesPerPixel) {
|
|
233
|
+
const rowBytes = width * bytesPerPixel;
|
|
234
|
+
const alignedRowBytes = Math.ceil(rowBytes / 4) * 4;
|
|
235
|
+
if (alignedRowBytes === rowBytes) {
|
|
236
|
+
return data;
|
|
237
|
+
}
|
|
238
|
+
const src = new Uint8Array(data.buffer, data.byteOffset, data.byteLength);
|
|
239
|
+
const dstBytes = new Uint8Array(alignedRowBytes * height);
|
|
240
|
+
for (let r = 0; r < height; r++) {
|
|
241
|
+
dstBytes.set(src.subarray(r * rowBytes, (r + 1) * rowBytes), r * alignedRowBytes);
|
|
242
|
+
}
|
|
243
|
+
// Return the same typed array type as the input
|
|
244
|
+
if (data instanceof Int8Array)
|
|
245
|
+
return new Int8Array(dstBytes.buffer);
|
|
246
|
+
if (data instanceof Uint16Array)
|
|
247
|
+
return new Uint16Array(dstBytes.buffer);
|
|
248
|
+
if (data instanceof Int16Array)
|
|
249
|
+
return new Int16Array(dstBytes.buffer);
|
|
250
|
+
return dstBytes;
|
|
251
|
+
}
|
|
149
252
|
//# sourceMappingURL=render-pipeline.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render-pipeline.js","sourceRoot":"","sources":["../../src/geotiff/render-pipeline.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"render-pipeline.js","sourceRoot":"","sources":["../../src/geotiff/render-pipeline.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE5D,OAAO,EACL,WAAW,EACX,SAAS,EACT,QAAQ,EACR,aAAa,EACb,WAAW,EACX,eAAe,EACf,WAAW,EACX,WAAW,GACZ,MAAM,6CAA6C,CAAC;AAMrD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAGzD,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AA4B/C,MAAM,UAAU,mBAAmB,CACjC,OAAgB,EAChB,MAAc;IAQd,MAAM,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;IAC5C,IAAI,YAAY,KAAK,IAAI,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAC;IAC3E,CAAC;IAED,QAAQ,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC;QACxB,oBAAoB;QACpB,KAAK,YAAY,CAAC,IAAI;YACpB,OAAO,mBAAmB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAChD,CAAC;IAED,MAAM,IAAI,KAAK,CACb,8FAA8F,YAAY,EAAE,CAC7G,CAAC;AACJ,CAAC;AAED;;G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,GAAG,IAAI,UAAU,CAAC,eAAe,GAAG,MAAM,CAAC,CAAC;IAC1D,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QAChC,QAAQ,CAAC,GAAG,CACV,GAAG,CAAC,QAAQ,CAAC,CAAC,GAAG,QAAQ,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,QAAQ,CAAC,EAC9C,CAAC,GAAG,eAAe,CACpB,CAAC;IACJ,CAAC;IAED,gDAAgD;IAChD,IAAI,IAAI,YAAY,SAAS;QAAE,OAAO,IAAI,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAM,CAAC;IAC1E,IAAI,IAAI,YAAY,WAAW;QAAE,OAAO,IAAI,WAAW,CAAC,QAAQ,CAAC,MAAM,CAAM,CAAC;IAC9E,IAAI,IAAI,YAAY,UAAU;QAAE,OAAO,IAAI,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAM,CAAC;IAC5E,OAAO,QAAa,CAAC;AACvB,CAAC"}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type {
|
|
1
|
+
import { SampleFormat } from "@cogeotiff/core";
|
|
2
|
+
import type { GeoTIFF } from "@developmentseed/geotiff";
|
|
3
|
+
import type { TextureFormat, TextureProps, TypedArray } from "@luma.gl/core";
|
|
3
4
|
/**
|
|
4
5
|
* Infers texture properties from a GeoTIFF image and its associated data.
|
|
5
6
|
*/
|
|
6
|
-
export declare function createTextureProps(
|
|
7
|
+
export declare function createTextureProps(geotiff: GeoTIFF, data: TypedArray, options: {
|
|
7
8
|
width: number;
|
|
8
9
|
height: number;
|
|
9
10
|
}): TextureProps;
|
|
10
11
|
/**
|
|
11
12
|
* Infer the TextureFormat given values from GeoTIFF tags.
|
|
12
13
|
*/
|
|
13
|
-
export declare function inferTextureFormat(samplesPerPixel: number, bitsPerSample: Uint16Array, sampleFormat:
|
|
14
|
+
export declare function inferTextureFormat(samplesPerPixel: number, bitsPerSample: Uint16Array, sampleFormat: SampleFormat[]): TextureFormat;
|
|
14
15
|
//# sourceMappingURL=texture.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"texture.d.ts","sourceRoot":"","sources":["../../src/geotiff/texture.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"texture.d.ts","sourceRoot":"","sources":["../../src/geotiff/texture.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE7E;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,UAAU,EAChB,OAAO,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GACzC,YAAY,CAed;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,eAAe,EAAE,MAAM,EACvB,aAAa,EAAE,WAAW,EAC1B,YAAY,EAAE,YAAY,EAAE,GAC3B,aAAa,CAef"}
|