@developmentseed/deck.gl-geotiff 0.2.0 → 0.3.0-beta.3
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/cog-layer.d.ts +34 -35
- package/dist/cog-layer.d.ts.map +1 -1
- package/dist/cog-layer.js +71 -76
- package/dist/cog-layer.js.map +1 -1
- package/dist/cog-tile-matrix-set.d.ts +2 -31
- package/dist/cog-tile-matrix-set.d.ts.map +1 -1
- package/dist/cog-tile-matrix-set.js +2 -159
- package/dist/cog-tile-matrix-set.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 +28 -101
- package/dist/geotiff/geotiff.js.map +1 -1
- package/dist/geotiff/high-level/affine.d.ts +16 -0
- package/dist/geotiff/high-level/affine.d.ts.map +1 -0
- package/dist/geotiff/high-level/affine.js +2 -0
- package/dist/geotiff/high-level/affine.js.map +1 -0
- package/dist/geotiff/high-level/array.d.ts +37 -0
- package/dist/geotiff/high-level/array.d.ts.map +1 -0
- package/dist/geotiff/high-level/array.js +2 -0
- package/dist/geotiff/high-level/array.js.map +1 -0
- package/dist/geotiff/high-level/geotiff.d.ts +63 -0
- package/dist/geotiff/high-level/geotiff.d.ts.map +1 -0
- package/dist/geotiff/high-level/geotiff.js +135 -0
- package/dist/geotiff/high-level/geotiff.js.map +1 -0
- package/dist/geotiff/high-level/index.d.ts +8 -0
- package/dist/geotiff/high-level/index.d.ts.map +1 -0
- package/dist/geotiff/high-level/index.js +5 -0
- package/dist/geotiff/high-level/index.js.map +1 -0
- package/dist/geotiff/high-level/options.d.ts +11 -0
- package/dist/geotiff/high-level/options.d.ts.map +1 -0
- package/dist/geotiff/high-level/options.js +2 -0
- package/dist/geotiff/high-level/options.js.map +1 -0
- package/dist/geotiff/high-level/overview.d.ts +46 -0
- package/dist/geotiff/high-level/overview.d.ts.map +1 -0
- package/dist/geotiff/high-level/overview.js +124 -0
- package/dist/geotiff/high-level/overview.js.map +1 -0
- package/dist/geotiff/high-level/tile.d.ts +11 -0
- package/dist/geotiff/high-level/tile.d.ts.map +1 -0
- package/dist/geotiff/high-level/tile.js +2 -0
- package/dist/geotiff/high-level/tile.js.map +1 -0
- package/dist/geotiff/high-level/transform.d.ts +23 -0
- package/dist/geotiff/high-level/transform.d.ts.map +1 -0
- package/dist/geotiff/high-level/transform.js +55 -0
- package/dist/geotiff/high-level/transform.js.map +1 -0
- package/dist/geotiff/high-level/window.d.ts +23 -0
- package/dist/geotiff/high-level/window.d.ts.map +1 -0
- package/dist/geotiff/high-level/window.js +31 -0
- package/dist/geotiff/high-level/window.js.map +1 -0
- package/dist/geotiff/render-pipeline.d.ts +2 -2
- package/dist/geotiff/render-pipeline.d.ts.map +1 -1
- package/dist/geotiff/render-pipeline.js +47 -44
- 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/types.d.ts +0 -29
- package/dist/geotiff/types.d.ts.map +1 -1
- package/dist/geotiff/types.js +1 -12
- package/dist/geotiff/types.js.map +1 -1
- package/dist/geotiff-layer.d.ts +17 -21
- 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 +4 -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/geotiff-types.d.ts +13 -0
- package/dist/geotiff-types.d.ts.map +1 -0
- package/dist/geotiff-types.js +2 -0
- package/dist/geotiff-types.js.map +1 -0
- package/dist/geotiff.d.ts +50 -0
- package/dist/geotiff.d.ts.map +1 -0
- package/dist/geotiff.js +135 -0
- package/dist/geotiff.js.map +1 -0
- package/dist/index.d.ts +0 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -6
- package/dist/index.js.map +1 -1
- package/dist/mosaic-layer/mosaic-tile-traversal.d.ts +1 -0
- package/dist/mosaic-layer/mosaic-tile-traversal.d.ts.map +1 -0
- package/dist/mosaic-layer/mosaic-tile-traversal.js +2 -0
- package/dist/mosaic-layer/mosaic-tile-traversal.js.map +1 -0
- package/dist/mosaic-layer.d.ts +1 -0
- package/dist/mosaic-layer.d.ts.map +1 -0
- package/dist/mosaic-layer.js +2 -0
- package/dist/mosaic-layer.js.map +1 -0
- 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/dist/texture.d.ts +10 -0
- package/dist/texture.d.ts.map +1 -0
- package/dist/texture.js +135 -0
- package/dist/texture.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +15 -11
|
@@ -1,23 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Photometric, SampleFormat } from "@cogeotiff/core";
|
|
2
|
+
import { CMYKToRGB, Colormap, CreateTexture, cieLabToRGB, FilterNoDataVal, } 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
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 tags = geotiff.cachedTags;
|
|
23
|
+
const { bitsPerSample, colorMap, photometric, sampleFormat, samplesPerPixel, nodata, } = tags;
|
|
21
24
|
const renderPipeline = [
|
|
22
25
|
{
|
|
23
26
|
module: CreateTexture,
|
|
@@ -26,22 +29,20 @@ function createUnormPipeline(ifd, device) {
|
|
|
26
29
|
},
|
|
27
30
|
},
|
|
28
31
|
];
|
|
29
|
-
|
|
30
|
-
const noDataVal = parseGDALNoData(GDAL_NODATA);
|
|
31
|
-
if (noDataVal !== null) {
|
|
32
|
+
if (nodata !== null) {
|
|
32
33
|
// Since values are 0-1 for unorm textures,
|
|
33
|
-
const noDataScaled =
|
|
34
|
+
const noDataScaled = nodata / 255.0;
|
|
34
35
|
renderPipeline.push({
|
|
35
36
|
module: FilterNoDataVal,
|
|
36
37
|
props: { value: noDataScaled },
|
|
37
38
|
});
|
|
38
39
|
}
|
|
39
|
-
const toRGBModule = photometricInterpretationToRGB(
|
|
40
|
+
const toRGBModule = photometricInterpretationToRGB(photometric, device, colorMap);
|
|
40
41
|
if (toRGBModule) {
|
|
41
42
|
renderPipeline.push(toRGBModule);
|
|
42
43
|
}
|
|
43
44
|
// For palette images, use nearest-neighbor sampling
|
|
44
|
-
const samplerOptions =
|
|
45
|
+
const samplerOptions = photometric === Photometric.Palette
|
|
45
46
|
? {
|
|
46
47
|
magFilter: "nearest",
|
|
47
48
|
minFilter: "nearest",
|
|
@@ -51,32 +52,32 @@ function createUnormPipeline(ifd, device) {
|
|
|
51
52
|
minFilter: "linear",
|
|
52
53
|
};
|
|
53
54
|
const getTileData = async (image, options) => {
|
|
54
|
-
const { device } = options;
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
let data = (await image.readRasters(mergedOptions));
|
|
60
|
-
let numSamples = SamplesPerPixel;
|
|
61
|
-
if (SamplesPerPixel === 3) {
|
|
55
|
+
const { device, x, y, signal } = options;
|
|
56
|
+
const tile = await image.fetchTile(x, y, { signal, boundless: false });
|
|
57
|
+
let { array } = tile;
|
|
58
|
+
let numSamples = samplesPerPixel;
|
|
59
|
+
if (samplesPerPixel === 3) {
|
|
62
60
|
// WebGL2 doesn't have an RGB-only texture format; it requires RGBA.
|
|
63
|
-
|
|
61
|
+
array = addAlphaChannel(array);
|
|
64
62
|
numSamples = 4;
|
|
65
63
|
}
|
|
64
|
+
if (array.layout === "band-separate") {
|
|
65
|
+
throw new Error("Band-separate images not yet implemented.");
|
|
66
|
+
}
|
|
66
67
|
const textureFormat = inferTextureFormat(
|
|
67
68
|
// Add one sample for added alpha channel
|
|
68
|
-
numSamples,
|
|
69
|
+
numSamples, bitsPerSample, sampleFormat);
|
|
69
70
|
const texture = device.createTexture({
|
|
70
|
-
data,
|
|
71
|
+
data: array.data,
|
|
71
72
|
format: textureFormat,
|
|
72
|
-
width:
|
|
73
|
-
height:
|
|
73
|
+
width: array.width,
|
|
74
|
+
height: array.height,
|
|
74
75
|
sampler: samplerOptions,
|
|
75
76
|
});
|
|
76
77
|
return {
|
|
77
78
|
texture,
|
|
78
|
-
height:
|
|
79
|
-
width:
|
|
79
|
+
height: array.height,
|
|
80
|
+
width: array.width,
|
|
80
81
|
};
|
|
81
82
|
};
|
|
82
83
|
const renderTile = (tileData) => {
|
|
@@ -84,11 +85,11 @@ function createUnormPipeline(ifd, device) {
|
|
|
84
85
|
};
|
|
85
86
|
return { getTileData, renderTile };
|
|
86
87
|
}
|
|
87
|
-
function photometricInterpretationToRGB(
|
|
88
|
-
switch (
|
|
89
|
-
case
|
|
88
|
+
function photometricInterpretationToRGB(photometric, device, ColorMap) {
|
|
89
|
+
switch (photometric) {
|
|
90
|
+
case Photometric.Rgb:
|
|
90
91
|
return null;
|
|
91
|
-
case
|
|
92
|
+
case Photometric.Palette: {
|
|
92
93
|
if (!ColorMap) {
|
|
93
94
|
throw new Error("ColorMap is required for PhotometricInterpretation Palette");
|
|
94
95
|
}
|
|
@@ -112,20 +113,22 @@ function photometricInterpretationToRGB(PhotometricInterpretation, device, Color
|
|
|
112
113
|
},
|
|
113
114
|
};
|
|
114
115
|
}
|
|
115
|
-
|
|
116
|
+
// Not sure why cogeotiff calls this "Separated", but it means CMYK
|
|
117
|
+
case Photometric.Separated:
|
|
116
118
|
return {
|
|
117
119
|
module: CMYKToRGB,
|
|
118
120
|
};
|
|
119
|
-
case
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
121
|
+
case Photometric.Ycbcr:
|
|
122
|
+
// @developmentseed/geotiff currently uses canvas to parse JPEG-compressed
|
|
123
|
+
// YCbCr images, which means the YCbCr->RGB conversion is already done by
|
|
124
|
+
// the browser's image decoder
|
|
125
|
+
return null;
|
|
126
|
+
case Photometric.Cielab:
|
|
124
127
|
return {
|
|
125
128
|
module: cieLabToRGB,
|
|
126
129
|
};
|
|
127
130
|
default:
|
|
128
|
-
throw new Error(`Unsupported PhotometricInterpretation ${
|
|
131
|
+
throw new Error(`Unsupported PhotometricInterpretation ${photometric}`);
|
|
129
132
|
}
|
|
130
133
|
}
|
|
131
134
|
/**
|
|
@@ -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,C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|
|
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"}
|
package/dist/geotiff/texture.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { SampleFormat } from "@cogeotiff/core";
|
|
1
2
|
/**
|
|
2
3
|
* Infers texture properties from a GeoTIFF image and its associated data.
|
|
3
4
|
*/
|
|
4
|
-
export function createTextureProps(
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const textureFormat = inferTextureFormat(samplesPerPixel, ifd.BitsPerSample, ifd.SampleFormat);
|
|
5
|
+
export function createTextureProps(geotiff, data, options) {
|
|
6
|
+
const { samplesPerPixel, bitsPerSample, sampleFormat } = geotiff.cachedTags;
|
|
7
|
+
const textureFormat = inferTextureFormat(samplesPerPixel, bitsPerSample, sampleFormat);
|
|
8
8
|
return {
|
|
9
9
|
data,
|
|
10
10
|
format: textureFormat,
|
|
@@ -60,11 +60,11 @@ function inferScalarKind(sampleFormat) {
|
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
switch (first) {
|
|
63
|
-
case
|
|
63
|
+
case SampleFormat.Uint:
|
|
64
64
|
return "unorm";
|
|
65
|
-
case
|
|
65
|
+
case SampleFormat.Int:
|
|
66
66
|
return "sint";
|
|
67
|
-
case
|
|
67
|
+
case SampleFormat.Float:
|
|
68
68
|
return "float";
|
|
69
69
|
default:
|
|
70
70
|
throw new Error(`Unsupported SampleFormat ${sampleFormat}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"texture.js","sourceRoot":"","sources":["../../src/geotiff/texture.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"texture.js","sourceRoot":"","sources":["../../src/geotiff/texture.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAI/C;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAChC,OAAgB,EAChB,IAAgB,EAChB,OAA0C;IAE1C,MAAM,EAAE,eAAe,EAAE,aAAa,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,UA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AAS;IACtB,YAAY,EAAE,UAAU;IAExB,mCAAmC;IACnC,UAAU,EAAE,SAAS;IACrB,UAAU,EAAE,SAAS;IACrB,WAAW,EAAE,UAAU;IAEvB,kCAAkC;IAClC,YAAY,EAAE,UAAU;IACxB,WAAW,EAAE,SAAS;IACtB,WAAW,EAAE,SAAS;IAEtB,mCAAmC;IACnC,YAAY,EAAE,WAAW;IACzB,WAAW,EAAE,UAAU;IACvB,WAAW,EAAE,UAAU;IACvB,YAAY,EAAE,WAAW;IAEzB,oCAAoC;IACpC,UAAU,EAAE,WAAW;IACvB,UAAU,EAAE,WAAW;IACvB,WAAW,EAAE,YAAY;IAEzB,qCAAqC;IACrC,gEAAgE;IAChE,gEAAgE;IAChE,WAAW,EAAE,kBAAkB;IAE/B,mCAAmC;IACnC,YAAY,EAAE,WAAW;IACzB,WAAW,EAAE,UAAU;IACvB,WAAW,EAAE,UAAU;IAEvB,oCAAoC;IACpC,YAAY,EAAE,aAAa;IAC3B,WAAW,EAAE,YAAY;IACzB,WAAW,EAAE,YAAY;IACzB,YAAY,EAAE,aAAa;IAE3B,sCAAsC;IACtC,YAAY,EAAE,kBAAkB;IAEhC,qCAAqC;IACrC,YAAY,EAAE,aAAa;IAC3B,WAAW,EAAE,YAAY;IACzB,WAAW,EAAE,YAAY;CAC1B,CAAC"}
|
package/dist/geotiff/types.d.ts
CHANGED
|
@@ -1,34 +1,5 @@
|
|
|
1
|
-
export declare enum PhotometricInterpretationT {
|
|
2
|
-
WhiteIsZero = 0,
|
|
3
|
-
BlackIsZero = 1,
|
|
4
|
-
RGB = 2,
|
|
5
|
-
Palette = 3,
|
|
6
|
-
TransparencyMask = 4,
|
|
7
|
-
CMYK = 5,
|
|
8
|
-
YCbCr = 6,
|
|
9
|
-
CIELab = 8,
|
|
10
|
-
ICCLab = 9
|
|
11
|
-
}
|
|
12
1
|
export declare enum PlanarConfigurationT {
|
|
13
2
|
Chunky = 1,
|
|
14
3
|
Planar = 2
|
|
15
4
|
}
|
|
16
|
-
/** Improved typing for IFD. */
|
|
17
|
-
export type ImageFileDirectory = {
|
|
18
|
-
BitsPerSample: Uint16Array;
|
|
19
|
-
ColorMap?: Uint16Array;
|
|
20
|
-
Compression: number;
|
|
21
|
-
/** GDAL NoData value as string.
|
|
22
|
-
* <https://gdal.org/en/stable/drivers/raster/gtiff.html#nodata-value>
|
|
23
|
-
*/
|
|
24
|
-
GDAL_NODATA?: string;
|
|
25
|
-
ImageLength: number;
|
|
26
|
-
ImageWidth: number;
|
|
27
|
-
PhotometricInterpretation: PhotometricInterpretationT;
|
|
28
|
-
/** Strip or tiled */
|
|
29
|
-
PlanarConfiguration: PlanarConfigurationT;
|
|
30
|
-
SampleFormat: Uint16Array;
|
|
31
|
-
/** Number of bands */
|
|
32
|
-
SamplesPerPixel: number;
|
|
33
|
-
};
|
|
34
5
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/geotiff/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/geotiff/types.ts"],"names":[],"mappings":"AACA,oBAAY,oBAAoB;IAC9B,MAAM,IAAI;IACV,MAAM,IAAI;CACX"}
|
package/dist/geotiff/types.js
CHANGED
|
@@ -1,15 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
(function (PhotometricInterpretationT) {
|
|
3
|
-
PhotometricInterpretationT[PhotometricInterpretationT["WhiteIsZero"] = 0] = "WhiteIsZero";
|
|
4
|
-
PhotometricInterpretationT[PhotometricInterpretationT["BlackIsZero"] = 1] = "BlackIsZero";
|
|
5
|
-
PhotometricInterpretationT[PhotometricInterpretationT["RGB"] = 2] = "RGB";
|
|
6
|
-
PhotometricInterpretationT[PhotometricInterpretationT["Palette"] = 3] = "Palette";
|
|
7
|
-
PhotometricInterpretationT[PhotometricInterpretationT["TransparencyMask"] = 4] = "TransparencyMask";
|
|
8
|
-
PhotometricInterpretationT[PhotometricInterpretationT["CMYK"] = 5] = "CMYK";
|
|
9
|
-
PhotometricInterpretationT[PhotometricInterpretationT["YCbCr"] = 6] = "YCbCr";
|
|
10
|
-
PhotometricInterpretationT[PhotometricInterpretationT["CIELab"] = 8] = "CIELab";
|
|
11
|
-
PhotometricInterpretationT[PhotometricInterpretationT["ICCLab"] = 9] = "ICCLab";
|
|
12
|
-
})(PhotometricInterpretationT || (PhotometricInterpretationT = {}));
|
|
1
|
+
// TODO: unused, probably remove
|
|
13
2
|
export var PlanarConfigurationT;
|
|
14
3
|
(function (PlanarConfigurationT) {
|
|
15
4
|
PlanarConfigurationT[PlanarConfigurationT["Chunky"] = 1] = "Chunky";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/geotiff/types.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/geotiff/types.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,MAAM,CAAN,IAAY,oBAGX;AAHD,WAAY,oBAAoB;IAC9B,mEAAU,CAAA;IACV,mEAAU,CAAA;AACZ,CAAC,EAHW,oBAAoB,KAApB,oBAAoB,QAG/B"}
|
package/dist/geotiff-layer.d.ts
CHANGED
|
@@ -1,37 +1,36 @@
|
|
|
1
1
|
import type { CompositeLayerProps, UpdateParameters } from "@deck.gl/core";
|
|
2
2
|
import { CompositeLayer } from "@deck.gl/core";
|
|
3
3
|
import { RasterLayer } from "@developmentseed/deck.gl-raster";
|
|
4
|
+
import type { GeoTIFF } from "@developmentseed/geotiff";
|
|
4
5
|
import type { ReprojectionFns } from "@developmentseed/raster-reproject";
|
|
5
|
-
import type {
|
|
6
|
-
import type {
|
|
7
|
-
import {
|
|
6
|
+
import type { ProjectionDefinition } from "wkt-parser";
|
|
7
|
+
import type { EpsgResolver } from "./proj.js";
|
|
8
|
+
import { epsgResolver } from "./proj.js";
|
|
8
9
|
export interface GeoTIFFLayerProps extends CompositeLayerProps {
|
|
9
10
|
/**
|
|
10
11
|
* GeoTIFF input.
|
|
11
12
|
*
|
|
12
|
-
* - URL string pointing to a GeoTIFF
|
|
13
|
-
* - ArrayBuffer containing the GeoTIFF data
|
|
14
|
-
* -
|
|
15
|
-
* - An instance of GeoTIFF.js's GeoTIFF class
|
|
16
|
-
* - An instance of GeoTIFF.js's BaseClient for custom fetching
|
|
13
|
+
* - {@link URL} or `string` pointing to a GeoTIFF
|
|
14
|
+
* - {@link ArrayBuffer} containing the GeoTIFF data
|
|
15
|
+
* - An instance of the {@link GeoTIFF} class.
|
|
17
16
|
*/
|
|
18
|
-
geotiff: GeoTIFF | string |
|
|
17
|
+
geotiff: GeoTIFF | string | URL | ArrayBuffer;
|
|
19
18
|
/**
|
|
20
|
-
* A function callback for parsing
|
|
21
|
-
*
|
|
19
|
+
* A function callback for parsing numeric EPSG codes to projection
|
|
20
|
+
* information (as returned by `wkt-parser`).
|
|
22
21
|
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
22
|
+
* The default implementation:
|
|
23
|
+
* - makes a request to epsg.io to resolve EPSG codes found in the GeoTIFF.
|
|
24
|
+
* - caches any previous requests
|
|
25
|
+
* - parses PROJJSON response with `wkt-parser`
|
|
26
26
|
*/
|
|
27
|
-
|
|
27
|
+
epsgResolver?: EpsgResolver;
|
|
28
28
|
/**
|
|
29
29
|
* GeoTIFF.js Pool for decoding image chunks.
|
|
30
30
|
*
|
|
31
31
|
* If none is provided, a default Pool will be created and shared between all
|
|
32
32
|
* COGLayer and GeoTIFFLayer instances.
|
|
33
33
|
*/
|
|
34
|
-
pool?: Pool;
|
|
35
34
|
/**
|
|
36
35
|
* Maximum reprojection error in pixels for mesh refinement.
|
|
37
36
|
* Lower values create denser meshes with higher accuracy.
|
|
@@ -50,12 +49,9 @@ export interface GeoTIFFLayerProps extends CompositeLayerProps {
|
|
|
50
49
|
debugOpacity?: number;
|
|
51
50
|
/**
|
|
52
51
|
* Called when the GeoTIFF metadata has been loaded and parsed.
|
|
53
|
-
*
|
|
54
|
-
* @param {GeoTIFF} geotiff
|
|
55
|
-
* @param {ProjectionInfo} projection
|
|
56
52
|
*/
|
|
57
53
|
onGeoTIFFLoad?: (geotiff: GeoTIFF, options: {
|
|
58
|
-
projection:
|
|
54
|
+
projection: ProjectionDefinition;
|
|
59
55
|
/**
|
|
60
56
|
* Bounds of the image in geographic coordinates (WGS84) [minLon, minLat,
|
|
61
57
|
* maxLon, maxLat]
|
|
@@ -78,7 +74,7 @@ export interface GeoTIFFLayerProps extends CompositeLayerProps {
|
|
|
78
74
|
export declare class GeoTIFFLayer extends CompositeLayer<GeoTIFFLayerProps> {
|
|
79
75
|
static layerName: string;
|
|
80
76
|
static defaultProps: {
|
|
81
|
-
|
|
77
|
+
epsgResolver: typeof epsgResolver;
|
|
82
78
|
};
|
|
83
79
|
state: {
|
|
84
80
|
reprojectionFns?: ReprojectionFns;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geotiff-layer.d.ts","sourceRoot":"","sources":["../src/geotiff-layer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"geotiff-layer.d.ts","sourceRoot":"","sources":["../src/geotiff-layer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACxD,O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IAAI,CAAC;IAe7C,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;IAwCpC,YAAY;CAsBb"}
|
package/dist/geotiff-layer.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { CompositeLayer } from "@deck.gl/core";
|
|
2
2
|
import { RasterLayer } from "@developmentseed/deck.gl-raster";
|
|
3
3
|
import proj4 from "proj4";
|
|
4
|
-
import
|
|
4
|
+
import wktParser from "wkt-parser";
|
|
5
|
+
import { fetchGeoTIFF, getGeographicBounds } from "./geotiff/geotiff.js";
|
|
5
6
|
import { extractGeotiffReprojectors } from "./geotiff-reprojection.js";
|
|
6
|
-
import {
|
|
7
|
+
import { epsgResolver } from "./proj.js";
|
|
7
8
|
const defaultProps = {
|
|
8
|
-
|
|
9
|
+
epsgResolver,
|
|
9
10
|
};
|
|
10
11
|
/**
|
|
11
12
|
* GeoTIFFLayer renders a GeoTIFF file from an arbitrary projection.
|
|
@@ -32,30 +33,33 @@ export class GeoTIFFLayer extends CompositeLayer {
|
|
|
32
33
|
}
|
|
33
34
|
async _parseGeoTIFF() {
|
|
34
35
|
const geotiff = await fetchGeoTIFF(this.props.geotiff);
|
|
35
|
-
const
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
const converter = proj4(sourceProjection
|
|
36
|
+
const crs = geotiff.crs;
|
|
37
|
+
const sourceProjection = typeof crs === "number"
|
|
38
|
+
? await this.props.epsgResolver(crs)
|
|
39
|
+
: wktParser(crs);
|
|
40
|
+
// @ts-expect-error proj4 has incomplete types that don't support wkt-parser
|
|
41
|
+
// output
|
|
42
|
+
const converter = proj4(sourceProjection, "EPSG:4326");
|
|
42
43
|
if (this.props.onGeoTIFFLoad) {
|
|
43
|
-
const geographicBounds = getGeographicBounds(
|
|
44
|
+
const geographicBounds = getGeographicBounds(geotiff, converter);
|
|
44
45
|
this.props.onGeoTIFFLoad(geotiff, {
|
|
45
46
|
projection: sourceProjection,
|
|
46
47
|
geographicBounds,
|
|
47
48
|
});
|
|
48
49
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
50
|
+
// @ts-expect-error unused variable
|
|
51
|
+
// biome-ignore lint/correctness/noUnusedVariables: not implemented
|
|
52
|
+
const reprojectionFns = await extractGeotiffReprojectors(geotiff, sourceProjection);
|
|
53
|
+
// Our GeoTIFF implementation doesn't currently support reading the full
|
|
54
|
+
// image; it only supports reading tiles.
|
|
55
|
+
throw new Error("Loading GeoTIFF image data not yet implemented");
|
|
56
|
+
// const { texture, height, width } = await loadRgbImage(image);
|
|
57
|
+
// this.setState({
|
|
58
|
+
// reprojectionFns,
|
|
59
|
+
// imageData: texture,
|
|
60
|
+
// height,
|
|
61
|
+
// width,
|
|
62
|
+
// });
|
|
59
63
|
}
|
|
60
64
|
renderLayers() {
|
|
61
65
|
const { reprojectionFns, imageData, height, width } = this.state;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geotiff-layer.js","sourceRoot":"","sources":["../src/geotiff-layer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAG9D,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"geotiff-layer.js","sourceRoot":"","sources":["../src/geotiff-layer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAG9D,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AACzE,OAAO,EAAE,0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AC7B,MAAM,gBAAgB,GAAG,mBAAmB,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;YACjE,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,OAAO,EAAE;gBAChC,UAAU,EAAE,gBAAgB;gBAC5B,gBAAgB;aACjB,CAAC,CAAC;QACL,CAAC;QAED,mCAAmC;QACnC,mEAAmE;QACnE,MAAM,eAAe,GAAG,MAAM,0BAA0B,CACtD,OAAO,EACP,gBAAgB,CACjB,CAAC;QAEF,wEAAwE;QACxE,yCAAyC;QACzC,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;QAClE,gEAAgE;QAEhE,kBAAkB;QAClB,qBAAqB;QACrB,wBAAwB;QACxB,YAAY;QACZ,WAAW;QACX,MAAM;IACR,CAAC;IAED,YAAY;QACV,MAAM,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC;QAEjE,IAAI,CAAC,eAAe,IAAI,CAAC,SAAS,IAAI,CAAC,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC;YACxD,OAAO,IAAI,CAAC;QACd,CAAC;QAED,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,YAAY,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC;QAErD,OAAO,IAAI,WAAW,CACpB,IAAI,CAAC,gBAAgB,CAAC;YACpB,EAAE,EAAE,QAAQ;YACZ,KAAK;YACL,MAAM;YACN,eAAe;YACf,QAAQ;YACR,OAAO,EAAE,SAAS;YAClB,KAAK;YACL,YAAY;SACb,CAAC,CACH,CAAC;IACJ,CAAC"}
|
|
@@ -1,25 +1,11 @@
|
|
|
1
|
+
import type { GeoTIFF } from "@developmentseed/geotiff";
|
|
1
2
|
import type { ReprojectionFns } from "@developmentseed/raster-reproject";
|
|
2
|
-
import type { GeoTIFF, GeoTIFFImage } from "geotiff";
|
|
3
3
|
import type { PROJJSONDefinition } from "proj4/dist/lib/core";
|
|
4
4
|
import type Projection from "proj4/dist/lib/Proj";
|
|
5
|
-
|
|
6
|
-
export declare function extractGeotiffReprojectors(
|
|
7
|
-
export declare function
|
|
5
|
+
import type { ProjectionDefinition } from "wkt-parser";
|
|
6
|
+
export declare function extractGeotiffReprojectors(geotiff: GeoTIFF, sourceProjection: string | PROJJSONDefinition | ProjectionDefinition, outputCrs?: string | PROJJSONDefinition | Projection): Promise<ReprojectionFns>;
|
|
7
|
+
export declare function fromAffine(geotransform: [number, number, number, number, number, number]): {
|
|
8
8
|
forwardTransform: (x: number, y: number) => [number, number];
|
|
9
9
|
inverseTransform: (x: number, y: number) => [number, number];
|
|
10
10
|
};
|
|
11
|
-
/**
|
|
12
|
-
* Extract affine geotransform from a GeoTIFF image.
|
|
13
|
-
*
|
|
14
|
-
* The first `image` must be passed in, as only the top-level IFD contains geo
|
|
15
|
-
* keys.
|
|
16
|
-
*
|
|
17
|
-
* Returns a 6-element array in Python `affine` package ordering:
|
|
18
|
-
* [a, b, c, d, e, f] where:
|
|
19
|
-
* - x_geo = a * col + b * row + c
|
|
20
|
-
* - y_geo = d * col + e * row + f
|
|
21
|
-
*
|
|
22
|
-
* This is NOT GDAL ordering, which is [c, a, b, f, d, e].
|
|
23
|
-
*/
|
|
24
|
-
export declare function extractGeotransform(image: GeoTIFFImage): [number, number, number, number, number, number];
|
|
25
11
|
//# sourceMappingURL=geotiff-reprojection.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geotiff-reprojection.d.ts","sourceRoot":"","sources":["../src/geotiff-reprojection.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"geotiff-reprojection.d.ts","sourceRoot":"","sources":["../src/geotiff-reprojection.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAEzE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,KAAK,UAAU,MAAM,qBAAqB,CAAC;AAClD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAMvD,wBAAsB,0BAA0B,CAC9C,OAAO,EAAE,OAAO,EAChB,gBAAgB,EAAE,MAAM,GAAG,kBAAkB,GAAG,oBAAoB,EACpE,SAAS,GAAE,MAAM,GAAG,kBAAkB,GAAG,UAAwB,GAChE,OAAO,CAAC,eAAe,CAAC,CAc1B;AAED,wBAAgB,UAAU,CACxB,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,GAC7D;IACD,gBAAgB,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7D,gBAAgB,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC9D,CAQA"}
|