@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,159 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { extractGeotransform } from "./geotiff-reprojection";
|
|
4
|
-
// 0.28 mm per pixel
|
|
5
|
-
// https://docs.ogc.org/is/17-083r4/17-083r4.html#toc15
|
|
6
|
-
const SCREEN_PIXEL_SIZE = 0.00028;
|
|
7
|
-
/**
|
|
8
|
-
*
|
|
9
|
-
* Ported from Vincent's work here:
|
|
10
|
-
* https://github.com/developmentseed/morecantile/pull/187/changes#diff-402eedddfa30af554d03750c8a82a09962b44b044976c321b774b484b98e8f48R665
|
|
11
|
-
*
|
|
12
|
-
* @return {TileMatrixSet}[return description]
|
|
13
|
-
*/
|
|
14
|
-
export async function parseCOGTileMatrixSet(tiff, geoKeysParser) {
|
|
15
|
-
const fullResImage = await tiff.getImage();
|
|
16
|
-
if (!fullResImage.isTiled) {
|
|
17
|
-
throw new Error("COG TileMatrixSet requires a tiled GeoTIFF");
|
|
18
|
-
}
|
|
19
|
-
const imageCount = await tiff.getImageCount();
|
|
20
|
-
const bbox = fullResImage.getBoundingBox();
|
|
21
|
-
const fullImageWidth = fullResImage.getWidth();
|
|
22
|
-
const fullImageHeight = fullResImage.getHeight();
|
|
23
|
-
const crs = await geoKeysParser(fullResImage.getGeoKeys());
|
|
24
|
-
if (crs === null) {
|
|
25
|
-
throw new Error("Could not determine coordinate reference system from GeoTIFF geo keys");
|
|
26
|
-
}
|
|
27
|
-
const projectToWgs84 = proj4(crs.def, "EPSG:4326").forward;
|
|
28
|
-
const projectTo3857 = proj4(crs.def, "EPSG:3857").forward;
|
|
29
|
-
const boundingBox = {
|
|
30
|
-
lowerLeft: [bbox[0], bbox[1]],
|
|
31
|
-
upperRight: [bbox[2], bbox[3]],
|
|
32
|
-
};
|
|
33
|
-
const transform = extractGeotransform(fullResImage);
|
|
34
|
-
if (transform[1] !== 0 || transform[3] !== 0) {
|
|
35
|
-
// TileMatrixSet assumes orthogonal axes
|
|
36
|
-
throw new Error("COG TileMatrixSet with rotation/skewed geotransform is not supported");
|
|
37
|
-
}
|
|
38
|
-
const cellSize = Math.abs(transform[0]);
|
|
39
|
-
const tileWidth = fullResImage.getTileWidth();
|
|
40
|
-
const tileHeight = fullResImage.getTileHeight();
|
|
41
|
-
const tileMatrices = [
|
|
42
|
-
{
|
|
43
|
-
// Set as highest resolution / finest level
|
|
44
|
-
id: String(imageCount - 1),
|
|
45
|
-
scaleDenominator: (cellSize * metersPerUnit(crs.parsed, crs.coordinatesUnits)) /
|
|
46
|
-
SCREEN_PIXEL_SIZE,
|
|
47
|
-
cellSize,
|
|
48
|
-
pointOfOrigin: [transform[2], transform[5]],
|
|
49
|
-
tileWidth: fullResImage.getTileWidth(),
|
|
50
|
-
tileHeight: fullResImage.getTileHeight(),
|
|
51
|
-
matrixWidth: Math.ceil(fullImageWidth / tileWidth),
|
|
52
|
-
matrixHeight: Math.ceil(fullImageHeight / tileHeight),
|
|
53
|
-
geotransform: transform,
|
|
54
|
-
},
|
|
55
|
-
];
|
|
56
|
-
// Starting from 1 to skip full res image
|
|
57
|
-
for (let imageIdx = 1; imageIdx < imageCount; imageIdx++) {
|
|
58
|
-
const image = await tiff.getImage(imageIdx);
|
|
59
|
-
if (!image.isTiled) {
|
|
60
|
-
throw new Error("COG TileMatrixSet requires a tiled GeoTIFF");
|
|
61
|
-
}
|
|
62
|
-
const tileMatrix = createOverviewTileMatrix({
|
|
63
|
-
id: String(imageCount - 1 - imageIdx),
|
|
64
|
-
image,
|
|
65
|
-
fullWidth: fullImageWidth,
|
|
66
|
-
fullHeight: fullImageHeight,
|
|
67
|
-
baseTransform: transform,
|
|
68
|
-
crs,
|
|
69
|
-
});
|
|
70
|
-
tileMatrices.push(tileMatrix);
|
|
71
|
-
}
|
|
72
|
-
// Reverse to have coarsest level first
|
|
73
|
-
tileMatrices.reverse();
|
|
74
|
-
return {
|
|
75
|
-
crs,
|
|
76
|
-
boundingBox,
|
|
77
|
-
wgsBounds: computeWgs84BoundingBox(boundingBox, projectToWgs84),
|
|
78
|
-
tileMatrices,
|
|
79
|
-
projectToWgs84,
|
|
80
|
-
projectTo3857,
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Coefficient to convert the coordinate reference system (CRS)
|
|
85
|
-
* units into meters (metersPerUnit).
|
|
86
|
-
*
|
|
87
|
-
* From note g in http://docs.opengeospatial.org/is/17-083r2/17-083r2.html#table_2:
|
|
88
|
-
*
|
|
89
|
-
* > If the CRS uses meters as units of measure for the horizontal dimensions,
|
|
90
|
-
* > then metersPerUnit=1; if it has degrees, then metersPerUnit=2pa/360
|
|
91
|
-
* > (a is the Earth maximum radius of the ellipsoid).
|
|
92
|
-
*
|
|
93
|
-
* If `crsUnit` is provided, it takes precedence over the unit defined in the
|
|
94
|
-
* CRS. This exists because sometimes the parsed CRS from
|
|
95
|
-
* `geotiff-geokeys-to-proj4` doesn't have a unit defined.
|
|
96
|
-
*/
|
|
97
|
-
// https://github.com/developmentseed/morecantile/blob/7c95a11c491303700d6e33e9c1607f2719584dec/morecantile/utils.py#L67-L90
|
|
98
|
-
function metersPerUnit(parsedCrs, crsUnit) {
|
|
99
|
-
const unit = (crsUnit || parsedCrs.units)?.toLowerCase();
|
|
100
|
-
switch (unit) {
|
|
101
|
-
case "m":
|
|
102
|
-
case "metre":
|
|
103
|
-
case "meter":
|
|
104
|
-
case "meters":
|
|
105
|
-
return 1;
|
|
106
|
-
case "foot":
|
|
107
|
-
return 0.3048;
|
|
108
|
-
case "us survey foot":
|
|
109
|
-
return 1200 / 3937;
|
|
110
|
-
}
|
|
111
|
-
if (unit === "degree") {
|
|
112
|
-
// 2 * π * ellipsoid semi-major-axis / 360
|
|
113
|
-
const { a } = Ellipsoid[parsedCrs.ellps];
|
|
114
|
-
return (2 * Math.PI * a) / 360;
|
|
115
|
-
}
|
|
116
|
-
throw new Error(`Unsupported CRS units: ${unit}`);
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* Create tile matrix for COG overview
|
|
120
|
-
*/
|
|
121
|
-
function createOverviewTileMatrix({ id, image, fullWidth, baseTransform, crs, }) {
|
|
122
|
-
const width = image.getWidth();
|
|
123
|
-
const height = image.getHeight();
|
|
124
|
-
// For now, just use scaleX
|
|
125
|
-
// https://github.com/developmentseed/morecantile/pull/187/changes#r2621314673
|
|
126
|
-
const scaleX = fullWidth / width;
|
|
127
|
-
// const scaleY = fullHeight / height;
|
|
128
|
-
// if (Math.abs(scaleX - scaleY) > 1e-3) {
|
|
129
|
-
// throw new Error("Non-uniform overview scaling detected (X/Y differ)");
|
|
130
|
-
// }
|
|
131
|
-
const scale = scaleX;
|
|
132
|
-
const geotransform = [
|
|
133
|
-
baseTransform[0] * scale,
|
|
134
|
-
baseTransform[1] * scale,
|
|
135
|
-
baseTransform[2], // x origin stays the same
|
|
136
|
-
baseTransform[3] * scale,
|
|
137
|
-
baseTransform[4] * scale,
|
|
138
|
-
baseTransform[5], // y origin stays the same
|
|
139
|
-
];
|
|
140
|
-
const cellSize = Math.abs(geotransform[0]);
|
|
141
|
-
const tileWidth = image.getTileWidth();
|
|
142
|
-
const tileHeight = image.getTileHeight();
|
|
143
|
-
return {
|
|
144
|
-
id,
|
|
145
|
-
scaleDenominator: (cellSize * metersPerUnit(crs.parsed, crs.coordinatesUnits)) /
|
|
146
|
-
SCREEN_PIXEL_SIZE,
|
|
147
|
-
cellSize,
|
|
148
|
-
pointOfOrigin: [geotransform[2], geotransform[5]],
|
|
149
|
-
tileWidth,
|
|
150
|
-
tileHeight,
|
|
151
|
-
matrixWidth: Math.ceil(width / tileWidth),
|
|
152
|
-
matrixHeight: Math.ceil(height / tileHeight),
|
|
153
|
-
geotransform,
|
|
154
|
-
};
|
|
155
|
-
}
|
|
156
|
-
function computeWgs84BoundingBox(boundingBox, projectToWgs84) {
|
|
1
|
+
// TODO: deduplicate with similar functions in various places in this codebase
|
|
2
|
+
export function computeWgs84BoundingBox(boundingBox, projectToWgs84) {
|
|
157
3
|
const lowerLeftWgs84 = projectToWgs84(boundingBox.lowerLeft);
|
|
158
4
|
const lowerRightWgs84 = projectToWgs84([
|
|
159
5
|
boundingBox.upperRight[0],
|
|
@@ -174,7 +20,4 @@ function computeWgs84BoundingBox(boundingBox, projectToWgs84) {
|
|
|
174
20
|
upperRight: [maxLon, maxLat],
|
|
175
21
|
};
|
|
176
22
|
}
|
|
177
|
-
export const __TEST_EXPORTS = {
|
|
178
|
-
metersPerUnit,
|
|
179
|
-
};
|
|
180
23
|
//# sourceMappingURL=cog-tile-matrix-set.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cog-tile-matrix-set.js","sourceRoot":"","sources":["../src/cog-tile-matrix-set.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cog-tile-matrix-set.js","sourceRoot":"","sources":["../src/cog-tile-matrix-set.ts"],"names":[],"mappings":"AAEA,8EAA8E;AAC9E,MAAM,UAAU,uBAAuB,CACrC,WAAwB,EACxB,cAA6D;IAE7D,MAAM,cAAc,GAAG,cAA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|
@@ -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,CAoClE;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,52 @@ 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;
|
|
24
|
+
const rgbaLength = (rgbImage.data.length / 3) * 4;
|
|
57
25
|
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];
|
|
26
|
+
for (let i = 0; i < rgbImage.data.length / 3; ++i) {
|
|
27
|
+
rgbaArray[i * 4] = rgbImage.data[i * 3];
|
|
28
|
+
rgbaArray[i * 4 + 1] = rgbImage.data[i * 3 + 1];
|
|
29
|
+
rgbaArray[i * 4 + 2] = rgbImage.data[i * 3 + 2];
|
|
62
30
|
rgbaArray[i * 4 + 3] = 255;
|
|
63
31
|
}
|
|
64
|
-
return
|
|
32
|
+
return {
|
|
33
|
+
...rgbImage,
|
|
34
|
+
count: 4,
|
|
35
|
+
data: rgbaArray,
|
|
36
|
+
};
|
|
65
37
|
}
|
|
66
38
|
else {
|
|
67
|
-
throw new Error(`Unexpected number of channels in raster data: ${rgbImage.length / (height * width)}`);
|
|
39
|
+
throw new Error(`Unexpected number of channels in raster data: ${rgbImage.data.length / (height * width)}`);
|
|
68
40
|
}
|
|
69
41
|
}
|
|
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
42
|
export async function fetchGeoTIFF(input) {
|
|
96
|
-
if (typeof input === "string") {
|
|
97
|
-
return fromUrl(input);
|
|
43
|
+
if (typeof input === "string" || input instanceof URL) {
|
|
44
|
+
return await GeoTIFF.fromUrl(input);
|
|
98
45
|
}
|
|
99
46
|
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);
|
|
47
|
+
return await GeoTIFF.fromArrayBuffer(input);
|
|
109
48
|
}
|
|
110
49
|
return input;
|
|
111
50
|
}
|
|
112
51
|
/**
|
|
113
52
|
* Calculate the WGS84 bounding box of a GeoTIFF image
|
|
114
53
|
*/
|
|
115
|
-
export function getGeographicBounds(
|
|
116
|
-
const
|
|
54
|
+
export function getGeographicBounds(geotiff, converter) {
|
|
55
|
+
const [minX, minY, maxX, maxY] = geotiff.bbox;
|
|
117
56
|
// Reproject all four corners to handle rotation/skew
|
|
118
|
-
const [minX, minY, maxX, maxY] = projectedBbox;
|
|
119
57
|
const corners = [
|
|
120
58
|
converter.forward([minX, minY]), // bottom-left
|
|
121
59
|
converter.forward([maxX, minY]), // bottom-right
|
|
@@ -132,15 +70,4 @@ export function getGeographicBounds(image, converter) {
|
|
|
132
70
|
// Return bounds in MapLibre format: [[west, south], [east, north]]
|
|
133
71
|
return { west, south, east, north };
|
|
134
72
|
}
|
|
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
73
|
//# 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,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;QAClD,MAAM,SAAS,GAAG,IAAI,iBAAiB,CAAC,UAAU,CAAC,CAAC;QACpD,KAAK,IAAI,CAAC,GAAG,CAAC,EAA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_px + f
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
export type Affine = [
|
|
9
|
+
a: number,
|
|
10
|
+
b: number,
|
|
11
|
+
c: number,
|
|
12
|
+
d: number,
|
|
13
|
+
e: number,
|
|
14
|
+
f: number
|
|
15
|
+
];
|
|
16
|
+
//# sourceMappingURL=affine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"affine.d.ts","sourceRoot":"","sources":["../../../src/geotiff/high-level/affine.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,MAAM,MAAM,GAAG;IACnB,CAAC,EAAE,MAAM;IACT,CAAC,EAAE,MAAM;IACT,CAAC,EAAE,MAAM;IACT,CAAC,EAAE,MAAM;IACT,CAAC,EAAE,MAAM;IACT,CAAC,EAAE,MAAM;CACV,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"affine.js","sourceRoot":"","sources":["../../../src/geotiff/high-level/affine.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { TypedArray } from "geotiff";
|
|
2
|
+
import type { Affine } from "./affine";
|
|
3
|
+
/**
|
|
4
|
+
* Decoded raster data from a GeoTIFF region.
|
|
5
|
+
*
|
|
6
|
+
* Data is stored in pixel-interleaved order (the native layout returned by
|
|
7
|
+
* geotiff.js with `interleave: true`): for each pixel in row-major order, all
|
|
8
|
+
* band values are contiguous. The flat array length is `height * width * bands`.
|
|
9
|
+
*/
|
|
10
|
+
export type RasterArray = {
|
|
11
|
+
/** Pixel-interleaved raster data with shape (bands, height, width) */
|
|
12
|
+
data: TypedArray;
|
|
13
|
+
/**
|
|
14
|
+
* Optional validity mask with shape (height, width).
|
|
15
|
+
*
|
|
16
|
+
* 1 = valid pixel
|
|
17
|
+
* 0 = nodata
|
|
18
|
+
*
|
|
19
|
+
* `null` when no mask IFD is present.
|
|
20
|
+
*/
|
|
21
|
+
mask: Uint8Array | null;
|
|
22
|
+
/** The number of bands in the array. */
|
|
23
|
+
count: number;
|
|
24
|
+
/** Height in pixels. */
|
|
25
|
+
height: number;
|
|
26
|
+
/** Width in pixels. */
|
|
27
|
+
width: number;
|
|
28
|
+
/**
|
|
29
|
+
* The affine transform mapping pixel coordinates to geographic coordinates.
|
|
30
|
+
*/
|
|
31
|
+
transform: Affine;
|
|
32
|
+
/** The coordinate reference system of the array. */
|
|
33
|
+
crs: string;
|
|
34
|
+
/** The nodata value for the array, if any. */
|
|
35
|
+
nodata: number | null;
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=array.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"array.d.ts","sourceRoot":"","sources":["../../../src/geotiff/high-level/array.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAEvC;;;;;;GAMG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,sEAAsE;IACtE,IAAI,EAAE,UAAU,CAAC;IAEjB;;;;;;;OAOG;IACH,IAAI,EAAE,UAAU,GAAG,IAAI,CAAC;IAExB,wCAAwC;IACxC,KAAK,EAAE,MAAM,CAAC;IAEd,wBAAwB;IACxB,MAAM,EAAE,MAAM,CAAC;IAEf,uBAAuB;IACvB,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB,oDAAoD;IACpD,GAAG,EAAE,MAAM,CAAC;IAEZ,8CAA8C;IAC9C,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"array.js","sourceRoot":"","sources":["../../../src/geotiff/high-level/array.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { GeoTransform } from "@developmentseed/raster-reproject/affine";
|
|
2
|
+
import type { GeoTIFFImage, GeoTIFF as UpstreamGeoTIFF } from "geotiff";
|
|
3
|
+
import type { RasterArray } from "./array.js";
|
|
4
|
+
import type { FetchOptions } from "./options.js";
|
|
5
|
+
import type { Overview } from "./overview.js";
|
|
6
|
+
import type { Tile } from "./tile.js";
|
|
7
|
+
import type { Window } from "./window.js";
|
|
8
|
+
/**
|
|
9
|
+
* A higher-level GeoTIFF abstraction that separates data IFDs from mask IFDs,
|
|
10
|
+
* pairs them by resolution, and exposes sorted overviews.
|
|
11
|
+
*
|
|
12
|
+
* Construct via `GeoTIFF.open(tiff)`.
|
|
13
|
+
*/
|
|
14
|
+
export declare class GeoTIFF {
|
|
15
|
+
/** The underlying GeoTIFF instance from geotiff.js */
|
|
16
|
+
private readonly tiff;
|
|
17
|
+
/**
|
|
18
|
+
* The primary (first) IFD of the GeoTIFF.
|
|
19
|
+
*
|
|
20
|
+
* Some tags, like most geo tags, only exist on the primary IFD.
|
|
21
|
+
*/
|
|
22
|
+
private readonly primaryIfd;
|
|
23
|
+
/**
|
|
24
|
+
* The mask IFD of the full-resolution GeoTIFF, if any.
|
|
25
|
+
*/
|
|
26
|
+
private readonly maskIfd;
|
|
27
|
+
/**
|
|
28
|
+
* Reduced-resolution overview levels, sorted finest-to-coarsest.
|
|
29
|
+
*
|
|
30
|
+
* Does not include the full-resolution image — use `fetchTile` / `read`
|
|
31
|
+
* on the GeoTIFF instance itself for that.
|
|
32
|
+
*/
|
|
33
|
+
readonly overviews: Overview[];
|
|
34
|
+
/** Affine geotransform of the full-resolution image. */
|
|
35
|
+
readonly transform: GeoTransform;
|
|
36
|
+
/** The primary (full-resolution) GeoTIFFImage. Useful for geo key access. */
|
|
37
|
+
readonly primaryImage: GeoTIFFImage;
|
|
38
|
+
/** Overview wrapper around the primary image, used by the convenience delegates. */
|
|
39
|
+
private readonly _primary;
|
|
40
|
+
private constructor();
|
|
41
|
+
/**
|
|
42
|
+
* Open a GeoTIFF and classify its IFDs into data/mask pairs.
|
|
43
|
+
*
|
|
44
|
+
* All IFDs are walked; mask IFDs are matched to data IFDs by matching
|
|
45
|
+
* (width, height). Overviews are sorted from finest to coarsest resolution.
|
|
46
|
+
*/
|
|
47
|
+
static open(tiff: UpstreamGeoTIFF): Promise<GeoTIFF>;
|
|
48
|
+
/** Fetch a single tile from the full-resolution image. */
|
|
49
|
+
fetchTile(x: number, y: number, options?: FetchOptions): Promise<Tile>;
|
|
50
|
+
/** Read an arbitrary window from the full-resolution image. */
|
|
51
|
+
read(window: Window, options?: FetchOptions): Promise<RasterArray>;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Determine whether a GeoTIFFImage is a mask IFD.
|
|
55
|
+
*
|
|
56
|
+
* Per the TIFF spec, bit 2 (value 4) of NewSubfileType signals
|
|
57
|
+
* "this IFD is a mask". We also require PhotometricInterpretation === 4
|
|
58
|
+
* (TransparencyMask) to confirm the intent.
|
|
59
|
+
*
|
|
60
|
+
* NewSubfileType defaults to 0 when absent from the file directory.
|
|
61
|
+
*/
|
|
62
|
+
export declare function isMaskIfd(image: GeoTIFFImage): boolean;
|
|
63
|
+
//# sourceMappingURL=geotiff.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geotiff.d.ts","sourceRoot":"","sources":["../../../src/geotiff/high-level/geotiff.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAC;AAC7E,OAAO,KAAK,EAAE,YAAY,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,SAAS,CAAC;AAGxE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,KAAK,EAAE,MAA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