@developmentseed/deck.gl-geotiff 0.3.0-beta.3 → 0.4.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 +42 -29
- package/dist/cog-layer.d.ts.map +1 -1
- package/dist/cog-layer.js +146 -38
- package/dist/cog-layer.js.map +1 -1
- package/dist/geotiff/geotiff.d.ts.map +1 -1
- package/dist/geotiff/geotiff.js +6 -2
- package/dist/geotiff/geotiff.js.map +1 -1
- package/dist/geotiff/render-pipeline.d.ts +7 -4
- package/dist/geotiff/render-pipeline.d.ts.map +1 -1
- package/dist/geotiff/render-pipeline.js +119 -16
- package/dist/geotiff/render-pipeline.js.map +1 -1
- package/dist/geotiff-layer.d.ts +5 -4
- package/dist/geotiff-layer.d.ts.map +1 -1
- package/dist/geotiff-layer.js.map +1 -1
- package/dist/geotiff-reprojection.d.ts +2 -1
- package/dist/geotiff-reprojection.d.ts.map +1 -1
- package/dist/geotiff-reprojection.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/proj.d.ts +20 -0
- package/dist/proj.d.ts.map +1 -1
- package/dist/proj.js +44 -0
- package/dist/proj.js.map +1 -1
- package/package.json +12 -12
- package/dist/cog-tile-matrix-set.d.ts +0 -3
- package/dist/cog-tile-matrix-set.d.ts.map +0 -1
- package/dist/cog-tile-matrix-set.js +0 -23
- 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/high-level/affine.d.ts +0 -16
- package/dist/geotiff/high-level/affine.d.ts.map +0 -1
- package/dist/geotiff/high-level/affine.js +0 -2
- package/dist/geotiff/high-level/affine.js.map +0 -1
- package/dist/geotiff/high-level/array.d.ts +0 -37
- package/dist/geotiff/high-level/array.d.ts.map +0 -1
- package/dist/geotiff/high-level/array.js +0 -2
- package/dist/geotiff/high-level/array.js.map +0 -1
- package/dist/geotiff/high-level/geotiff.d.ts +0 -63
- package/dist/geotiff/high-level/geotiff.d.ts.map +0 -1
- package/dist/geotiff/high-level/geotiff.js +0 -135
- package/dist/geotiff/high-level/geotiff.js.map +0 -1
- package/dist/geotiff/high-level/index.d.ts +0 -8
- package/dist/geotiff/high-level/index.d.ts.map +0 -1
- package/dist/geotiff/high-level/index.js +0 -5
- package/dist/geotiff/high-level/index.js.map +0 -1
- package/dist/geotiff/high-level/options.d.ts +0 -11
- package/dist/geotiff/high-level/options.d.ts.map +0 -1
- package/dist/geotiff/high-level/options.js +0 -2
- package/dist/geotiff/high-level/options.js.map +0 -1
- package/dist/geotiff/high-level/overview.d.ts +0 -46
- package/dist/geotiff/high-level/overview.d.ts.map +0 -1
- package/dist/geotiff/high-level/overview.js +0 -124
- package/dist/geotiff/high-level/overview.js.map +0 -1
- package/dist/geotiff/high-level/tile.d.ts +0 -11
- package/dist/geotiff/high-level/tile.d.ts.map +0 -1
- package/dist/geotiff/high-level/tile.js +0 -2
- package/dist/geotiff/high-level/tile.js.map +0 -1
- package/dist/geotiff/high-level/transform.d.ts +0 -23
- package/dist/geotiff/high-level/transform.d.ts.map +0 -1
- package/dist/geotiff/high-level/transform.js +0 -55
- package/dist/geotiff/high-level/transform.js.map +0 -1
- package/dist/geotiff/high-level/window.d.ts +0 -23
- package/dist/geotiff/high-level/window.d.ts.map +0 -1
- package/dist/geotiff/high-level/window.js +0 -31
- package/dist/geotiff/high-level/window.js.map +0 -1
- package/dist/geotiff/types.d.ts +0 -5
- package/dist/geotiff/types.d.ts.map +0 -1
- package/dist/geotiff/types.js +0 -7
- package/dist/geotiff/types.js.map +0 -1
- package/dist/geotiff-types.d.ts +0 -13
- package/dist/geotiff-types.d.ts.map +0 -1
- package/dist/geotiff-types.js +0 -2
- package/dist/geotiff-types.js.map +0 -1
- package/dist/geotiff.d.ts +0 -50
- package/dist/geotiff.d.ts.map +0 -1
- package/dist/geotiff.js +0 -135
- package/dist/geotiff.js.map +0 -1
- package/dist/mosaic-layer/mosaic-tile-traversal.d.ts +0 -1
- package/dist/mosaic-layer/mosaic-tile-traversal.d.ts.map +0 -1
- package/dist/mosaic-layer/mosaic-tile-traversal.js +0 -2
- package/dist/mosaic-layer/mosaic-tile-traversal.js.map +0 -1
- package/dist/mosaic-layer.d.ts +0 -1
- package/dist/mosaic-layer.d.ts.map +0 -1
- package/dist/mosaic-layer.js +0 -2
- package/dist/mosaic-layer.js.map +0 -1
- package/dist/texture.d.ts +0 -10
- package/dist/texture.d.ts.map +0 -1
- package/dist/texture.js +0 -135
- package/dist/texture.js.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import type { GeoTransform } from "@developmentseed/raster-reproject/affine";
|
|
2
|
-
import type { GeoTIFFImage } from "geotiff";
|
|
3
|
-
import type { RasterArray } from "./array.js";
|
|
4
|
-
import type { FetchOptions } from "./options.js";
|
|
5
|
-
import type { Tile } from "./tile.js";
|
|
6
|
-
import type { Window } from "./window.js";
|
|
7
|
-
/**
|
|
8
|
-
* A single resolution level of a GeoTIFF — either the full-resolution image or
|
|
9
|
-
* an overview. Pairs the data IFD with its corresponding mask IFD (if any).
|
|
10
|
-
*/
|
|
11
|
-
export declare class Overview {
|
|
12
|
-
/** The data IFD for this resolution level. */
|
|
13
|
-
readonly image: GeoTIFFImage;
|
|
14
|
-
/** The mask IFD, or null when no mask exists at this level. */
|
|
15
|
-
readonly maskImage: GeoTIFFImage | null;
|
|
16
|
-
/** Affine geotransform for this overview's pixel grid. */
|
|
17
|
-
readonly transform: GeoTransform;
|
|
18
|
-
/** Image width in pixels. */
|
|
19
|
-
readonly width: number;
|
|
20
|
-
/** Image height in pixels. */
|
|
21
|
-
readonly height: number;
|
|
22
|
-
/** Tile width in pixels (equals image width when the image is not tiled). */
|
|
23
|
-
readonly tileWidth: number;
|
|
24
|
-
/** Tile height in pixels (equals image height when the image is not tiled). */
|
|
25
|
-
readonly tileHeight: number;
|
|
26
|
-
constructor(image: GeoTIFFImage, maskImage: GeoTIFFImage | null, transform: GeoTransform);
|
|
27
|
-
/**
|
|
28
|
-
* Fetch a single tile by its grid indices.
|
|
29
|
-
*
|
|
30
|
-
* Edge tiles (at the right or bottom of the image) are clamped to the image
|
|
31
|
-
* bounds and will be smaller than tileWidth × tileHeight.
|
|
32
|
-
*/
|
|
33
|
-
fetchTile(x: number, y: number, options?: FetchOptions): Promise<Tile>;
|
|
34
|
-
/**
|
|
35
|
-
* Read an arbitrary rectangular window of pixel data.
|
|
36
|
-
*
|
|
37
|
-
* The window is in pixel coordinates of this overview's image.
|
|
38
|
-
*/
|
|
39
|
-
read(window: Window, options?: FetchOptions): Promise<RasterArray>;
|
|
40
|
-
/**
|
|
41
|
-
* Core read: fetches data (and mask in parallel if present) for the given
|
|
42
|
-
* pixel rectangle, and assembles a RasterArray.
|
|
43
|
-
*/
|
|
44
|
-
private _readRegion;
|
|
45
|
-
}
|
|
46
|
-
//# sourceMappingURL=overview.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"overview.d.ts","sourceRoot":"","sources":["../../../src/geotiff/high-level/overview.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAC;AAC7E,OAAO,KAAK,EAAE,YAAY,EAA4B,MAAM,SAAS,CAAC;AAEtE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C;;;GAGG;AACH,qBAAa,QAAQ;IACnB,8CAA8C;IAC9C,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC;IAC7B,+DAA+D;IAC/D,QAAQ,CAAC,SAAS,EAAE,YAAY,GAAG,IAAI,CAAC;IACxC,0DAA0D;IAC1D,QAAQ,CAAC,SAAS,EAAE,YAAY,CAAC;IACjC,6BAA6B;IAC7B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,8BAA8B;IAC9B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,6EAA6E;IAC7E,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,+EAA+E;IAC/E,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;gBAG1B,KAAK,EAAE,YAAY,EACnB,SAAS,EAAE,YAAY,GAAG,IAAI,EAC9B,SAAS,EAAE,YAAY;IAWzB;;;;;OAKG;IACG,SAAS,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAW5E;;;;OAIG;IACG,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC;IAmBxE;;;OAGG;YACW,WAAW;CAsE1B"}
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import { defaultPool } from "../geotiff.js";
|
|
2
|
-
/**
|
|
3
|
-
* A single resolution level of a GeoTIFF — either the full-resolution image or
|
|
4
|
-
* an overview. Pairs the data IFD with its corresponding mask IFD (if any).
|
|
5
|
-
*/
|
|
6
|
-
export class Overview {
|
|
7
|
-
/** The data IFD for this resolution level. */
|
|
8
|
-
image;
|
|
9
|
-
/** The mask IFD, or null when no mask exists at this level. */
|
|
10
|
-
maskImage;
|
|
11
|
-
/** Affine geotransform for this overview's pixel grid. */
|
|
12
|
-
transform;
|
|
13
|
-
/** Image width in pixels. */
|
|
14
|
-
width;
|
|
15
|
-
/** Image height in pixels. */
|
|
16
|
-
height;
|
|
17
|
-
/** Tile width in pixels (equals image width when the image is not tiled). */
|
|
18
|
-
tileWidth;
|
|
19
|
-
/** Tile height in pixels (equals image height when the image is not tiled). */
|
|
20
|
-
tileHeight;
|
|
21
|
-
constructor(image, maskImage, transform) {
|
|
22
|
-
this.image = image;
|
|
23
|
-
this.maskImage = maskImage;
|
|
24
|
-
this.transform = transform;
|
|
25
|
-
this.width = image.getWidth();
|
|
26
|
-
this.height = image.getHeight();
|
|
27
|
-
this.tileWidth = image.isTiled ? image.getTileWidth() : this.width;
|
|
28
|
-
this.tileHeight = image.isTiled ? image.getTileHeight() : this.height;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Fetch a single tile by its grid indices.
|
|
32
|
-
*
|
|
33
|
-
* Edge tiles (at the right or bottom of the image) are clamped to the image
|
|
34
|
-
* bounds and will be smaller than tileWidth × tileHeight.
|
|
35
|
-
*/
|
|
36
|
-
async fetchTile(x, y, options) {
|
|
37
|
-
const left = x * this.tileWidth;
|
|
38
|
-
const top = y * this.tileHeight;
|
|
39
|
-
const right = Math.min(left + this.tileWidth, this.width);
|
|
40
|
-
const bottom = Math.min(top + this.tileHeight, this.height);
|
|
41
|
-
const array = await this._readRegion(left, top, right, bottom, options);
|
|
42
|
-
return { x, y, array };
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Read an arbitrary rectangular window of pixel data.
|
|
46
|
-
*
|
|
47
|
-
* The window is in pixel coordinates of this overview's image.
|
|
48
|
-
*/
|
|
49
|
-
async read(window, options) {
|
|
50
|
-
const resolvedPool = options?.pool ?? defaultPool();
|
|
51
|
-
const left = window.colOff;
|
|
52
|
-
const top = window.rowOff;
|
|
53
|
-
const right = left + window.width;
|
|
54
|
-
const bottom = top + window.height;
|
|
55
|
-
if (right > this.width || bottom > this.height) {
|
|
56
|
-
throw new Error(`Window extends outside image bounds. ` +
|
|
57
|
-
`Window: cols=${left}:${right}, rows=${top}:${bottom}. ` +
|
|
58
|
-
`Image size: ${this.height}x${this.width}`);
|
|
59
|
-
}
|
|
60
|
-
return this._readRegion(left, top, right, bottom, options);
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Core read: fetches data (and mask in parallel if present) for the given
|
|
64
|
-
* pixel rectangle, and assembles a RasterArray.
|
|
65
|
-
*/
|
|
66
|
-
async _readRegion(left, top, right, bottom, options) {
|
|
67
|
-
const pool = options?.pool ?? defaultPool();
|
|
68
|
-
const signal = options?.signal;
|
|
69
|
-
// geotiff.js window: [left, top, right, bottom] in pixel coordinates
|
|
70
|
-
const window = [left, top, right, bottom];
|
|
71
|
-
const dataPromise = this.image.readRasters({
|
|
72
|
-
window,
|
|
73
|
-
interleave: true,
|
|
74
|
-
pool,
|
|
75
|
-
signal,
|
|
76
|
-
});
|
|
77
|
-
const maskPromise = this.maskImage
|
|
78
|
-
? this.maskImage.readRasters({
|
|
79
|
-
window,
|
|
80
|
-
interleave: true,
|
|
81
|
-
pool,
|
|
82
|
-
signal,
|
|
83
|
-
})
|
|
84
|
-
: null;
|
|
85
|
-
const [dataResult, maskResult] = await Promise.all([
|
|
86
|
-
dataPromise,
|
|
87
|
-
maskPromise,
|
|
88
|
-
]);
|
|
89
|
-
const height = dataResult.height;
|
|
90
|
-
const width = dataResult.width;
|
|
91
|
-
const bands = this.image.getSamplesPerPixel();
|
|
92
|
-
// Compute the affine transform for this region by translating the overview
|
|
93
|
-
// transform by the pixel offset: transform * translate(left, top)
|
|
94
|
-
// For [a, b, c, d, e, f]:
|
|
95
|
-
// new_c = a * left + b * top + c
|
|
96
|
-
// new_f = d * left + e * top + f
|
|
97
|
-
const [a, b, c, d, e, f] = this.transform;
|
|
98
|
-
const regionTransform = [
|
|
99
|
-
a,
|
|
100
|
-
b,
|
|
101
|
-
a * left + b * top + c,
|
|
102
|
-
d,
|
|
103
|
-
e,
|
|
104
|
-
d * left + e * top + f,
|
|
105
|
-
];
|
|
106
|
-
// Mask is single-band; convert to Uint8Array validity mask (1=valid, 0=nodata)
|
|
107
|
-
let mask = null;
|
|
108
|
-
if (maskResult) {
|
|
109
|
-
mask = new Uint8Array(height * width);
|
|
110
|
-
for (let i = 0; i < mask.length; i++) {
|
|
111
|
-
mask[i] = maskResult[i] !== 0 ? 1 : 0;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
return {
|
|
115
|
-
data: dataResult,
|
|
116
|
-
mask,
|
|
117
|
-
bands,
|
|
118
|
-
height,
|
|
119
|
-
width,
|
|
120
|
-
transform: regionTransform,
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
//# sourceMappingURL=overview.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"overview.js","sourceRoot":"","sources":["../../../src/geotiff/high-level/overview.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAM5C;;;GAGG;AACH,MAAM,OAAO,QAAQ;IACnB,8CAA8C;IACrC,KAAK,CAAe;IAC7B,+DAA+D;IACtD,SAAS,CAAsB;IACxC,0DAA0D;IACjD,SAAS,CAAe;IACjC,6BAA6B;IACpB,KAAK,CAAS;IACvB,8BAA8B;IACrB,MAAM,CAAS;IACxB,6EAA6E;IACpE,SAAS,CAAS;IAC3B,+EAA+E;IACtE,UAAU,CAAS;IAE5B,YACE,KAAmB,EACnB,SAA8B,EAC9B,SAAuB;QAEvB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAC;QAC9B,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAChC,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,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E,CAAC;QAE9C,2EAA2E;QAC3E,kEAAkE;QAClE,0BAA0B;QAC1B,mCAAmC;QACnC,mCAAmC;QACnC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC;QAC1C,MAAM,eAAe,GAAiB;YACpC,CAAC;YACD,CAAC;YACD,CAAC,GAAG,IAAI,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC;YACtB,CAAC;YACD,CAAC;YACD,CAAC,GAAG,IAAI,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC;SACvB,CAAC;QAEF,+EAA+E;QAC/E,IAAI,IAAI,GAAsB,IAAI,CAAC;QACnC,IAAI,UAAU,EAAE,CAAC;YACf,IAAI,GAAG,IAAI,UAAU,CAAC,MAAM,GAAG,KAAK,CAAC,CAAC;YACtC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;gBACrC,IAAI,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YACzC,CAAC;QACH,CAAC;QAED,OAAO;YACL,IAAI,EAAE,UAAU;YAChB,IAAI;YACJ,KAAK;YACL,MAAM;YACN,KAAK;YACL,SAAS,EAAE,eAAe;SAC3B,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { RasterArray } from "./array.js";
|
|
2
|
-
/** A single tile fetched from a GeoTIFF or Overview. */
|
|
3
|
-
export type Tile = {
|
|
4
|
-
/** Tile column index in the image's tile grid. */
|
|
5
|
-
x: number;
|
|
6
|
-
/** Tile row index in the image's tile grid. */
|
|
7
|
-
y: number;
|
|
8
|
-
/** Decoded raster data for this tile. */
|
|
9
|
-
array: RasterArray;
|
|
10
|
-
};
|
|
11
|
-
//# sourceMappingURL=tile.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tile.d.ts","sourceRoot":"","sources":["../../../src/geotiff/high-level/tile.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C,wDAAwD;AACxD,MAAM,MAAM,IAAI,GAAG;IACjB,kDAAkD;IAClD,CAAC,EAAE,MAAM,CAAC;IACV,+CAA+C;IAC/C,CAAC,EAAE,MAAM,CAAC;IACV,yCAAyC;IACzC,KAAK,EAAE,WAAW,CAAC;CACpB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tile.js","sourceRoot":"","sources":["../../../src/geotiff/high-level/tile.ts"],"names":[],"mappings":""}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { GeoTransform } from "@developmentseed/raster-reproject/affine";
|
|
2
|
-
/**
|
|
3
|
-
* Get the (row, col) pixel index containing the geographic coordinate (x, y).
|
|
4
|
-
*
|
|
5
|
-
* @param transform Affine geotransform [a, b, c, d, e, f].
|
|
6
|
-
* @param x x coordinate in the CRS.
|
|
7
|
-
* @param y y coordinate in the CRS.
|
|
8
|
-
* @param op Rounding function applied to fractional pixel indices.
|
|
9
|
-
* Defaults to Math.floor.
|
|
10
|
-
* @returns [row, col] pixel indices.
|
|
11
|
-
*/
|
|
12
|
-
export declare function index(transform: GeoTransform, x: number, y: number, op?: (n: number) => number): [number, number];
|
|
13
|
-
/**
|
|
14
|
-
* Get the geographic (x, y) coordinate of the pixel at (row, col).
|
|
15
|
-
*
|
|
16
|
-
* @param transform Affine geotransform [a, b, c, d, e, f].
|
|
17
|
-
* @param row Pixel row.
|
|
18
|
-
* @param col Pixel column.
|
|
19
|
-
* @param offset Which part of the pixel to return. Defaults to "center".
|
|
20
|
-
* @returns [x, y] in the CRS.
|
|
21
|
-
*/
|
|
22
|
-
export declare function xy(transform: GeoTransform, row: number, col: number, offset?: "center" | "ul" | "ur" | "ll" | "lr"): [number, number];
|
|
23
|
-
//# sourceMappingURL=transform.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["../../../src/geotiff/high-level/transform.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAC;AAM7E;;;;;;;;;GASG;AACH,wBAAgB,KAAK,CACnB,SAAS,EAAE,YAAY,EACvB,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,EAAE,GAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAmB,GACrC,CAAC,MAAM,EAAE,MAAM,CAAC,CAMlB;AAED;;;;;;;;GAQG;AACH,wBAAgB,EAAE,CAChB,SAAS,EAAE,YAAY,EACvB,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,EACX,MAAM,GAAE,QAAQ,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAe,GACtD,CAAC,MAAM,EAAE,MAAM,CAAC,CA4BlB"}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { applyAffine, invertGeoTransform, } from "@developmentseed/raster-reproject/affine";
|
|
2
|
-
/**
|
|
3
|
-
* Get the (row, col) pixel index containing the geographic coordinate (x, y).
|
|
4
|
-
*
|
|
5
|
-
* @param transform Affine geotransform [a, b, c, d, e, f].
|
|
6
|
-
* @param x x coordinate in the CRS.
|
|
7
|
-
* @param y y coordinate in the CRS.
|
|
8
|
-
* @param op Rounding function applied to fractional pixel indices.
|
|
9
|
-
* Defaults to Math.floor.
|
|
10
|
-
* @returns [row, col] pixel indices.
|
|
11
|
-
*/
|
|
12
|
-
export function index(transform, x, y, op = Math.floor) {
|
|
13
|
-
const inv = invertGeoTransform(transform);
|
|
14
|
-
// applyAffine(col, row, gt) → [x, y], so with the inverse:
|
|
15
|
-
// applyAffine(x, y, inv) → [col, row]
|
|
16
|
-
const [col, row] = applyAffine(x, y, inv);
|
|
17
|
-
return [op(row), op(col)];
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Get the geographic (x, y) coordinate of the pixel at (row, col).
|
|
21
|
-
*
|
|
22
|
-
* @param transform Affine geotransform [a, b, c, d, e, f].
|
|
23
|
-
* @param row Pixel row.
|
|
24
|
-
* @param col Pixel column.
|
|
25
|
-
* @param offset Which part of the pixel to return. Defaults to "center".
|
|
26
|
-
* @returns [x, y] in the CRS.
|
|
27
|
-
*/
|
|
28
|
-
export function xy(transform, row, col, offset = "center") {
|
|
29
|
-
let c;
|
|
30
|
-
let r;
|
|
31
|
-
switch (offset) {
|
|
32
|
-
case "center":
|
|
33
|
-
c = col + 0.5;
|
|
34
|
-
r = row + 0.5;
|
|
35
|
-
break;
|
|
36
|
-
case "ul":
|
|
37
|
-
c = col;
|
|
38
|
-
r = row;
|
|
39
|
-
break;
|
|
40
|
-
case "ur":
|
|
41
|
-
c = col + 1;
|
|
42
|
-
r = row;
|
|
43
|
-
break;
|
|
44
|
-
case "ll":
|
|
45
|
-
c = col;
|
|
46
|
-
r = row + 1;
|
|
47
|
-
break;
|
|
48
|
-
case "lr":
|
|
49
|
-
c = col + 1;
|
|
50
|
-
r = row + 1;
|
|
51
|
-
break;
|
|
52
|
-
}
|
|
53
|
-
return applyAffine(c, r, transform);
|
|
54
|
-
}
|
|
55
|
-
//# sourceMappingURL=transform.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transform.js","sourceRoot":"","sources":["../../../src/geotiff/high-level/transform.ts"],"names":[],"mappings":"AACA,OAAO,EACL,WAAW,EACX,kBAAkB,GACnB,MAAM,0CAA0C,CAAC;AAElD;;;;;;;;;GASG;AACH,MAAM,UAAU,KAAK,CACnB,SAAuB,EACvB,CAAS,EACT,CAAS,EACT,KAA4B,IAAI,CAAC,KAAK;IAEtC,MAAM,GAAG,GAAG,kBAAkB,CAAC,SAAS,CAAC,CAAC;IAC1C,2DAA2D;IAC3D,sCAAsC;IACtC,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,WAAW,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC;IAC1C,OAAO,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;AAC5B,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,EAAE,CAChB,SAAuB,EACvB,GAAW,EACX,GAAW,EACX,SAA+C,QAAQ;IAEvD,IAAI,CAAS,CAAC;IACd,IAAI,CAAS,CAAC;IAEd,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,QAAQ;YACX,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC;YACd,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC;YACd,MAAM;QACR,KAAK,IAAI;YACP,CAAC,GAAG,GAAG,CAAC;YACR,CAAC,GAAG,GAAG,CAAC;YACR,MAAM;QACR,KAAK,IAAI;YACP,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC;YACZ,CAAC,GAAG,GAAG,CAAC;YACR,MAAM;QACR,KAAK,IAAI;YACP,CAAC,GAAG,GAAG,CAAC;YACR,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC;YACZ,MAAM;QACR,KAAK,IAAI;YACP,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC;YACZ,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC;YACZ,MAAM;IACV,CAAC;IAED,OAAO,WAAW,CAAC,CAAC,EAAE,CAAC,EAAE,SAAS,CAAC,CAAC;AACtC,CAAC"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/** A rectangular subset of a raster in pixel coordinates. */
|
|
2
|
-
export type Window = {
|
|
3
|
-
/** Column offset (x position of the left edge). */
|
|
4
|
-
colOff: number;
|
|
5
|
-
/** Row offset (y position of the top edge). */
|
|
6
|
-
rowOff: number;
|
|
7
|
-
/** Width in pixels (number of columns). */
|
|
8
|
-
width: number;
|
|
9
|
-
/** Height in pixels (number of rows). */
|
|
10
|
-
height: number;
|
|
11
|
-
};
|
|
12
|
-
/**
|
|
13
|
-
* Create a Window, validating that offsets are non-negative and dimensions are
|
|
14
|
-
* positive.
|
|
15
|
-
*/
|
|
16
|
-
export declare function createWindow(colOff: number, rowOff: number, width: number, height: number): Window;
|
|
17
|
-
/**
|
|
18
|
-
* Compute the intersection of two windows.
|
|
19
|
-
*
|
|
20
|
-
* Returns null if the windows do not overlap.
|
|
21
|
-
*/
|
|
22
|
-
export declare function intersectWindows(a: Window, b: Window): Window | null;
|
|
23
|
-
//# sourceMappingURL=window.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"window.d.ts","sourceRoot":"","sources":["../../../src/geotiff/high-level/window.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,MAAM,MAAM,MAAM,GAAG;IACnB,mDAAmD;IACnD,MAAM,EAAE,MAAM,CAAC;IACf,+CAA+C;IAC/C,MAAM,EAAE,MAAM,CAAC;IACf,2CAA2C;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,yCAAyC;IACzC,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;;GAGG;AACH,wBAAgB,YAAY,CAC1B,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,GACb,MAAM,CAcR;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAcpE"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Create a Window, validating that offsets are non-negative and dimensions are
|
|
3
|
-
* positive.
|
|
4
|
-
*/
|
|
5
|
-
export function createWindow(colOff, rowOff, width, height) {
|
|
6
|
-
if (colOff < 0 || rowOff < 0) {
|
|
7
|
-
throw new Error(`Window offsets must be non-negative, got colOff=${colOff}, rowOff=${rowOff}`);
|
|
8
|
-
}
|
|
9
|
-
if (width <= 0 || height <= 0) {
|
|
10
|
-
throw new Error(`Window dimensions must be positive, got width=${width}, height=${height}`);
|
|
11
|
-
}
|
|
12
|
-
return { colOff, rowOff, width, height };
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Compute the intersection of two windows.
|
|
16
|
-
*
|
|
17
|
-
* Returns null if the windows do not overlap.
|
|
18
|
-
*/
|
|
19
|
-
export function intersectWindows(a, b) {
|
|
20
|
-
const colOff = Math.max(a.colOff, b.colOff);
|
|
21
|
-
const rowOff = Math.max(a.rowOff, b.rowOff);
|
|
22
|
-
const colStop = Math.min(a.colOff + a.width, b.colOff + b.width);
|
|
23
|
-
const rowStop = Math.min(a.rowOff + a.height, b.rowOff + b.height);
|
|
24
|
-
const width = colStop - colOff;
|
|
25
|
-
const height = rowStop - rowOff;
|
|
26
|
-
if (width <= 0 || height <= 0) {
|
|
27
|
-
return null;
|
|
28
|
-
}
|
|
29
|
-
return { colOff, rowOff, width, height };
|
|
30
|
-
}
|
|
31
|
-
//# sourceMappingURL=window.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"window.js","sourceRoot":"","sources":["../../../src/geotiff/high-level/window.ts"],"names":[],"mappings":"AAYA;;;GAGG;AACH,MAAM,UAAU,YAAY,CAC1B,MAAc,EACd,MAAc,EACd,KAAa,EACb,MAAc;IAEd,IAAI,MAAM,GAAG,CAAC,IAAI,MAAM,GAAG,CAAC,EAAE,CAAC;QAC7B,MAAM,IAAI,KAAK,CACb,mDAAmD,MAAM,YAAY,MAAM,EAAE,CAC9E,CAAC;IACJ,CAAC;IAED,IAAI,KAAK,IAAI,CAAC,IAAI,MAAM,IAAI,CAAC,EAAE,CAAC;QAC9B,MAAM,IAAI,KAAK,CACb,iDAAiD,KAAK,YAAY,MAAM,EAAE,CAC3E,CAAC;IACJ,CAAC;IAED,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;AAC3C,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,CAAS,EAAE,CAAS;IACnD,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC;IAC5C,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC;IAC5C,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;IACjE,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC;IAEnE,MAAM,KAAK,GAAG,OAAO,GAAG,MAAM,CAAC;IAC/B,MAAM,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;IAEhC,IAAI,KAAK,IAAI,CAAC,IAAI,MAAM,IAAI,CAAC,EAAE,CAAC;QAC9B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;AAC3C,CAAC"}
|
package/dist/geotiff/types.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
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
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
// TODO: unused, probably remove
|
|
2
|
-
export var PlanarConfigurationT;
|
|
3
|
-
(function (PlanarConfigurationT) {
|
|
4
|
-
PlanarConfigurationT[PlanarConfigurationT["Chunky"] = 1] = "Chunky";
|
|
5
|
-
PlanarConfigurationT[PlanarConfigurationT["Planar"] = 2] = "Planar";
|
|
6
|
-
})(PlanarConfigurationT || (PlanarConfigurationT = {}));
|
|
7
|
-
//# sourceMappingURL=types.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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-types.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { globals } from "geotiff";
|
|
2
|
-
/** Improved typing for IFD. */
|
|
3
|
-
export type ImageFileDirectory = {
|
|
4
|
-
ImageWidth: number;
|
|
5
|
-
ImageLength: number;
|
|
6
|
-
BitsPerSample: Uint16Array;
|
|
7
|
-
Compression: number;
|
|
8
|
-
PhotometricInterpretation: typeof globals.photometricInterpretations;
|
|
9
|
-
SamplesPerPixel: number;
|
|
10
|
-
SampleFormat: Uint16Array;
|
|
11
|
-
PlanarConfiguration: number;
|
|
12
|
-
};
|
|
13
|
-
//# sourceMappingURL=geotiff-types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"geotiff-types.d.ts","sourceRoot":"","sources":["../src/geotiff-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEvC,+BAA+B;AAC/B,MAAM,MAAM,kBAAkB,GAAG;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,WAAW,CAAC;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,yBAAyB,EAAE,OAAO,OAAO,CAAC,0BAA0B,CAAC;IACrE,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,WAAW,CAAC;IAC1B,mBAAmB,EAAE,MAAM,CAAC;CAC7B,CAAC"}
|
package/dist/geotiff-types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"geotiff-types.js","sourceRoot":"","sources":["../src/geotiff-types.ts"],"names":[],"mappings":""}
|
package/dist/geotiff.d.ts
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import type { GeoTIFF, GeoTIFFImage } from "geotiff";
|
|
2
|
-
import { BaseClient, Pool } from "geotiff";
|
|
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
|
-
/**
|
|
32
|
-
* Parse the GeoTIFF `ColorMap` tag into an ImageData.
|
|
33
|
-
*
|
|
34
|
-
* @param {Uint16Array} cmap The colormap array from the GeoTIFF `ColorMap` tag.
|
|
35
|
-
*
|
|
36
|
-
* @return {ImageData} The parsed colormap as an ImageData object.
|
|
37
|
-
*/
|
|
38
|
-
export declare function parseColormap(cmap: Uint16Array): ImageData;
|
|
39
|
-
export declare function fetchGeoTIFF(input: GeoTIFF | string | ArrayBuffer | Blob | BaseClient): Promise<GeoTIFF>;
|
|
40
|
-
/**
|
|
41
|
-
* Calculate the WGS84 bounding box of a GeoTIFF image
|
|
42
|
-
*/
|
|
43
|
-
export declare function getGeographicBounds(image: GeoTIFFImage, converter: Converter): {
|
|
44
|
-
west: number;
|
|
45
|
-
south: number;
|
|
46
|
-
east: number;
|
|
47
|
-
north: number;
|
|
48
|
-
};
|
|
49
|
-
export {};
|
|
50
|
-
//# sourceMappingURL=geotiff.d.ts.map
|
package/dist/geotiff.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"geotiff.d.ts","sourceRoot":"","sources":["../src/geotiff.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAA4B,MAAM,SAAS,CAAC;AAC/E,OAAO,EACL,UAAU,EAKV,IAAI,EACL,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC;;GAEG;AACH,KAAK,iBAAiB,GAAG;IACvB,8CAA8C;IAC9C,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IAE1C,wCAAwC;IACxC,IAAI,CAAC,EAAE,IAAI,CAAC;IAEZ,2EAA2E;IAC3E,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB,CAAC;AASF;;;;;;GAMG;AACH,wBAAgB,WAAW,IAAI,IAAI,CAMlC;AAED;;GAEG;AACH,wBAAsB,YAAY,CAChC,KAAK,EAAE,YAAY,EACnB,OAAO,CAAC,EAAE,iBAAiB,GAC1B,OAAO,CAAC;IAAE,OAAO,EAAE,SAAS,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,CAmBhE;AAkCD;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,WAAW,GAAG,SAAS,CAqB1D;AAED,wBAAsB,YAAY,CAChC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,WAAW,GAAG,IAAI,GAAG,UAAU,GACxD,OAAO,CAAC,OAAO,CAAC,CAoBlB;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,YAAY,EACnB,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,CA4B9D"}
|
package/dist/geotiff.js
DELETED
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
// Utilities for interacting with geotiff.js.
|
|
2
|
-
import { BaseClient, fromArrayBuffer, fromBlob, fromCustomClient, fromUrl, Pool, } from "geotiff";
|
|
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
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Add an alpha channel to an RGB image array.
|
|
44
|
-
*
|
|
45
|
-
* Only supports input arrays with 3 (RGB) or 4 (RGBA) channels. If the input is
|
|
46
|
-
* already RGBA, it is returned unchanged.
|
|
47
|
-
*/
|
|
48
|
-
function addAlphaChannel(rgbImage) {
|
|
49
|
-
const { height, width } = rgbImage;
|
|
50
|
-
if (rgbImage.length === height * width * 4) {
|
|
51
|
-
// Already has alpha channel
|
|
52
|
-
return new ImageData(new Uint8ClampedArray(rgbImage), width, height);
|
|
53
|
-
}
|
|
54
|
-
else if (rgbImage.length === height * width * 3) {
|
|
55
|
-
// Need to add alpha channel
|
|
56
|
-
const rgbaLength = (rgbImage.length / 3) * 4;
|
|
57
|
-
const rgbaArray = new Uint8ClampedArray(rgbaLength);
|
|
58
|
-
for (let i = 0; i < rgbImage.length / 3; ++i) {
|
|
59
|
-
rgbaArray[i * 4] = rgbImage[i * 3];
|
|
60
|
-
rgbaArray[i * 4 + 1] = rgbImage[i * 3 + 1];
|
|
61
|
-
rgbaArray[i * 4 + 2] = rgbImage[i * 3 + 2];
|
|
62
|
-
rgbaArray[i * 4 + 3] = 255;
|
|
63
|
-
}
|
|
64
|
-
return new ImageData(rgbaArray, width, height);
|
|
65
|
-
}
|
|
66
|
-
else {
|
|
67
|
-
throw new Error(`Unexpected number of channels in raster data: ${rgbImage.length / (height * width)}`);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
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
|
-
export async function fetchGeoTIFF(input) {
|
|
96
|
-
if (typeof input === "string") {
|
|
97
|
-
return fromUrl(input);
|
|
98
|
-
}
|
|
99
|
-
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);
|
|
109
|
-
}
|
|
110
|
-
return input;
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* Calculate the WGS84 bounding box of a GeoTIFF image
|
|
114
|
-
*/
|
|
115
|
-
export function getGeographicBounds(image, converter) {
|
|
116
|
-
const projectedBbox = image.getBoundingBox();
|
|
117
|
-
// Reproject all four corners to handle rotation/skew
|
|
118
|
-
const [minX, minY, maxX, maxY] = projectedBbox;
|
|
119
|
-
const corners = [
|
|
120
|
-
converter.forward([minX, minY]), // bottom-left
|
|
121
|
-
converter.forward([maxX, minY]), // bottom-right
|
|
122
|
-
converter.forward([maxX, maxY]), // top-right
|
|
123
|
-
converter.forward([minX, maxY]), // top-left
|
|
124
|
-
];
|
|
125
|
-
// Find the bounding box that encompasses all reprojected corners
|
|
126
|
-
const lons = corners.map((c) => c[0]);
|
|
127
|
-
const lats = corners.map((c) => c[1]);
|
|
128
|
-
const west = Math.min(...lons);
|
|
129
|
-
const south = Math.min(...lats);
|
|
130
|
-
const east = Math.max(...lons);
|
|
131
|
-
const north = Math.max(...lats);
|
|
132
|
-
// Return bounds in MapLibre format: [[west, south], [east, north]]
|
|
133
|
-
return { west, south, east, north };
|
|
134
|
-
}
|
|
135
|
-
//# sourceMappingURL=geotiff.js.map
|
package/dist/geotiff.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"geotiff.js","sourceRoot":"","sources":["../src/geotiff.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAG7C,OAAO,EACL,UAAU,EACV,eAAe,EACf,QAAQ,EACR,gBAAgB,EAChB,OAAO,EACP,IAAI,GACL,MAAM,SAAS,CAAC;AAiBjB;;;;GAIG;AACH,IAAI,YAAY,GAAgB,IAAI,CAAC;AAErC;;;;;;GAMG;AACH,MAAM,UAAU,WAAW;IACzB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AAI,EAAE,IAAI,CAAC,CAAC,EAAE,cAAc;QAC/C,SAAS,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,EAAE,eAAe;QAChD,SAAS,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,EAAE,YAAY;QAC7C,SAAS,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,EAAE,WAAW;KAC7C,CAAC;IAEF,iEAAiE;IACjE,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACtC,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAEtC,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC;IAC/B,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC;IAChC,MAAM,IAAI,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 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=mosaic-tile-traversal.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mosaic-tile-traversal.d.ts","sourceRoot":"","sources":["../../src/mosaic-layer/mosaic-tile-traversal.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mosaic-tile-traversal.js","sourceRoot":"","sources":["../../src/mosaic-layer/mosaic-tile-traversal.ts"],"names":[],"mappings":""}
|
package/dist/mosaic-layer.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=mosaic-layer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mosaic-layer.d.ts","sourceRoot":"","sources":["../src/mosaic-layer.ts"],"names":[],"mappings":""}
|
package/dist/mosaic-layer.js
DELETED
package/dist/mosaic-layer.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mosaic-layer.js","sourceRoot":"","sources":["../src/mosaic-layer.ts"],"names":[],"mappings":""}
|