@gisatcz/deckgl-geolib 1.12.0-dev.0 → 1.12.0-dev.11

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.
@@ -65,9 +65,7 @@ export default class CogBitmapLayer<ExtraPropsT extends {} = {}> extends Composi
65
65
  getTileData: any;
66
66
  renderSubLayers: any;
67
67
  updateTriggers: {
68
- getTileData: {
69
- clampToTerrain: boolean | ClampToTerrainOptions;
70
- };
68
+ getTileData: (number | boolean | ClampToTerrainOptions)[];
71
69
  };
72
70
  extent: any;
73
71
  tileSize: any;
@@ -79,7 +77,7 @@ export default class CogBitmapLayer<ExtraPropsT extends {} = {}> extends Composi
79
77
  onTileError: (err: any, tile?: any) => void;
80
78
  maxCacheSize: number;
81
79
  maxCacheByteSize: number;
82
- refinementStrategy: import("node_modules/@deck.gl/geo-layers/dist/tileset-2d/tileset-2d.js").RefinementStrategy;
80
+ refinementStrategy: import("@deck.gl/geo-layers/dist/tileset-2d/tileset-2d").RefinementStrategy;
83
81
  }>;
84
82
  }
85
83
  export {};
@@ -1,29 +1,134 @@
1
- import { Tiff, TiffImage } from '@cogeotiff/core';
2
- import LZWDecoder from './lzw';
1
+ import { GeoTIFF, GeoTIFFImage } from 'geotiff';
3
2
  import GeoImage, { GeoImageOptions } from '../geoimage/geoimage.ts';
4
3
  export type Bounds = [minX: number, minY: number, maxX: number, maxY: number];
5
4
  declare class CogTiles {
6
- cog: Tiff;
5
+ cog: GeoTIFF;
6
+ cogZoomLookup: number[];
7
+ cogResolutionLookup: number[];
8
+ cogOrigin: number[];
7
9
  zoomRange: number[];
8
10
  tileSize: number;
9
- lowestOriginTileOffset: number[];
10
- lowestOriginTileSize: number;
11
+ bounds: Bounds;
11
12
  loaded: boolean;
12
13
  geo: GeoImage;
13
- lzw: LZWDecoder;
14
14
  options: GeoImageOptions;
15
15
  constructor(options: GeoImageOptions);
16
- initializeCog(url: string): Promise<Tiff>;
17
- getTileSize(cog: Tiff): number;
18
- getZoomRange(cog: Tiff): number[];
19
- getBoundsAsLatLon(cog: Tiff): [number, number, number, number];
20
- getOriginAsLatLon(cog: Tiff): number[];
21
- getImageTileIndex(img: TiffImage): number[];
22
- getResolutionFromZoomLevel(tileSize: number, z: number): number;
16
+ initializeCog(url: string): Promise<void>;
17
+ getZoomRange(): number[];
18
+ calculateZoomRange(img: GeoTIFFImage, imgCount: number): number[];
19
+ calculateBoundsAsLatLon(image: GeoTIFFImage): [number, number, number, number];
23
20
  getZoomLevelFromResolution(tileSize: number, resolution: number): number;
21
+ getBoundsAsLatLon(): Bounds;
24
22
  getLatLon(input: number[]): number[];
25
- getTile(x: number, y: number, z: number, bounds: Bounds, meshMaxError: number): Promise<string>;
26
- getFormat(sampleFormat: number[] | number, bitsPerSample: number[] | number): any;
27
- getNoDataValue(tags: any): number;
23
+ /**
24
+ * Builds lookup tables for zoom levels and estimated resolutions from a Cloud Optimized GeoTIFF (COG) object.
25
+ *
26
+ * It is assumed that inn web mapping, COG data is visualized in the Web Mercator coordinate system.
27
+ * At zoom level 0, the Web Mercator resolution is defined by the constant `webMercatorRes0`
28
+ * (e.g., 156543.03125 m/pixel). At each subsequent zoom level, this resolution is halved.
29
+ *
30
+ * This function calculates, for each image (overview) in the COG, its estimated resolution and
31
+ * corresponding zoom level based on the base image's resolution and width.
32
+ *
33
+ * @param {object} cog - A Cloud Optimized GeoTIFF object loaded via geotiff.js.
34
+ * @returns {Promise<[number[], number[]]>} A promise resolving to a tuple of two arrays:
35
+ * - The first array (`zoomLookup`) maps each image index to its computed zoom level.
36
+ * - The second array (`resolutionLookup`) maps each image index to its estimated resolution (m/pixel).
37
+ */
38
+ buildCogZoomResolutionLookup(cog: any): Promise<any[][]>;
39
+ /**
40
+ * Determines the appropriate image index from the Cloud Optimized GeoTIFF (COG)
41
+ * that best matches a given zoom level.
42
+ *
43
+ * This function utilizes precomputed lookup tables (`cogZoomLookup`) that map
44
+ * each image index in the COG to its corresponding zoom level. It ensures that
45
+ * the selected image index provides the closest resolution to the desired zoom level.
46
+ *
47
+ * @param {number} zoom - The target zoom level for which the image index is sought.
48
+ * @returns {number} The index of the image in the COG that best matches the specified zoom level.
49
+ */
50
+ getImageIndexForZoomLevel(zoom: any): number;
51
+ getTileFromImage(tileX: any, tileY: any, zoom: any): Promise<any[][] | import("geotiff").ReadRasterResult[]>;
52
+ getTile(x: number, y: number, z: number, bounds: Bounds, meshMaxError: number): Promise<string | {
53
+ loaderData: {
54
+ header: {};
55
+ };
56
+ header: {
57
+ vertexCount: any;
58
+ boundingBox: [[number, number, number], [number, number, number]];
59
+ };
60
+ mode: number;
61
+ indices: {
62
+ value: Uint32Array<ArrayBuffer>;
63
+ size: number;
64
+ };
65
+ attributes: {
66
+ POSITION: {
67
+ value: Float32Array<ArrayBuffer>;
68
+ size: number;
69
+ };
70
+ TEXCOORD_0: {
71
+ value: Float32Array<ArrayBuffer>;
72
+ size: number;
73
+ };
74
+ };
75
+ }>;
76
+ /**
77
+ * Determines the data type (e.g., "Int32", "Float64") of a GeoTIFF image
78
+ * by reading its TIFF tags.
79
+ *
80
+ * @param {GeoTIFFImage} image - A GeoTIFF.js image.
81
+ * @returns {Promise<string>} - A string representing the data type.
82
+ */
83
+ getDataTypeFromTags(image: any): string;
84
+ /**
85
+ * Extracts the noData value from a GeoTIFF.js image.
86
+ * Returns the noData value as a number (including NaN) if available, otherwise undefined.
87
+ *
88
+ * @param {GeoTIFFImage} image - The GeoTIFF.js image.
89
+ * @returns {number|undefined} The noData value, possibly NaN, or undefined if not set or invalid.
90
+ */
91
+ getNoDataValue(image: any): number;
92
+ /**
93
+ * Retrieves the number of channels (samples per pixel) in a GeoTIFF image.
94
+ *
95
+ * @param {GeoTIFFImage} image - A GeoTIFFImage object from which to extract the number of channels.
96
+ * @returns {number} The number of channels in the image.
97
+ */
98
+ getNumberOfChannels(image: any): any;
99
+ /**
100
+ * Calculates the intersection between a tile bounding box and a COG bounding box,
101
+ * returning the intersection window in image pixel space (relative to COG offsets),
102
+ * along with how much blank space (nodata) appears on the left and top of the tile.
103
+ *
104
+ * @param {number[]} tileBbox - Tile bounding box: [minX, minY, maxX, maxY]
105
+ * @param {number[]} cogBbox - COG bounding box: [minX, minY, maxX, maxY]
106
+ * @param {number} offsetXPixel - X offset of the COG origin in pixel space
107
+ * @param {number} offsetYPixel - Y offset of the COG origin in pixel space
108
+ * @param {number} tileSize - Size of the tile in pixels (default: 256)
109
+ * @returns {[number, number, number[] | null, number, number]}
110
+ * An array containing:
111
+ * - width of the intersection
112
+ * - height of the intersection
113
+ * - pixel-space window: [startX, startY, endX, endY] or null if no overlap
114
+ * - missingLeft: padding pixels on the left
115
+ * - missingTop: padding pixels on the top
116
+ */
117
+ getIntersectionBBox(tileBbox: any, cogBbox: any, offsetXPixel?: number, offsetYPixel?: number, tileSize?: number): any[];
118
+ /**
119
+ * Retrieves the PlanarConfiguration value from a GeoTIFF image.
120
+ *
121
+ * @param {GeoTIFFImage} image - The GeoTIFF image object.
122
+ * @returns {number} The PlanarConfiguration value (1 for Chunky format, 2 for Planar format).
123
+ */
124
+ getPlanarConfiguration(image: any): any;
125
+ /**
126
+ * Creates a tile buffer of the specified size using a typed array corresponding to the provided data type.
127
+ *
128
+ * @param {string} dataType - A string specifying the data type (e.g., "Int32", "Float64", "UInt16", etc.).
129
+ * @param {number} tileSize - The width/height of the square tile.
130
+ * @returns {TypedArray} A typed array buffer of length tileSize * tileSize.
131
+ */
132
+ createTileBuffer(dataType: any, tileSize: any): Uint32Array<ArrayBuffer> | Float32Array<ArrayBuffer> | Uint8Array<ArrayBuffer> | Int8Array<ArrayBuffer> | Int16Array<ArrayBuffer> | Uint16Array<ArrayBuffer> | Int32Array<ArrayBuffer> | Float64Array<ArrayBuffer>;
28
133
  }
29
134
  export default CogTiles;
@@ -34,6 +34,7 @@ export type GeoImageOptions = {
34
34
  terrainColor?: Array<number> | chroma.Color;
35
35
  terrainSkirtHeight?: number;
36
36
  terrainMinValue?: number;
37
+ planarConfig?: number;
37
38
  };
38
39
  export declare const DefaultGeoImageOptions: GeoImageOptions;
39
40
  export default class GeoImage {
@@ -55,16 +56,16 @@ export default class GeoImage {
55
56
  };
56
57
  mode: number;
57
58
  indices: {
58
- value: Uint32Array;
59
+ value: Uint32Array<ArrayBuffer>;
59
60
  size: number;
60
61
  };
61
62
  attributes: {
62
63
  POSITION: {
63
- value: Float32Array;
64
+ value: Float32Array<ArrayBuffer>;
64
65
  size: number;
65
66
  };
66
67
  TEXCOORD_0: {
67
- value: Float32Array;
68
+ value: Float32Array<ArrayBuffer>;
68
69
  size: number;
69
70
  };
70
71
  };
@@ -84,16 +85,16 @@ export default class GeoImage {
84
85
  };
85
86
  mode: number;
86
87
  indices: {
87
- value: Uint32Array;
88
+ value: Uint32Array<ArrayBuffer>;
88
89
  size: number;
89
90
  };
90
91
  attributes: {
91
92
  POSITION: {
92
- value: Float32Array;
93
+ value: Float32Array<ArrayBuffer>;
93
94
  size: number;
94
95
  };
95
96
  TEXCOORD_0: {
96
- value: Float32Array;
97
+ value: Float32Array<ArrayBuffer>;
97
98
  size: number;
98
99
  };
99
100
  };
package/package.json CHANGED
@@ -1,17 +1,39 @@
1
1
  {
2
2
  "name": "@gisatcz/deckgl-geolib",
3
- "version": "1.12.0-dev.0",
3
+ "version": "1.12.0-dev.11",
4
+ "description": "Deck.gl extension for rendering Cloud-Optimized GeoTIFF (COG) data",
5
+ "keywords": ["deck.gl", "geotiff", "webgl", "gis", "visualization", "cog"],
4
6
  "private": false,
7
+ "license": "MIT",
8
+ "author": "Gisat",
9
+ "homepage": "https://github.com/gisat/deck.gl-geotiff/tree/master/geoimage#readme",
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "git+https://github.com/Gisat/deck.gl-geotiff.git",
13
+ "directory": "geoimage"
14
+ },
15
+ "bugs": {
16
+ "url": "https://github.com/gisat/deck.gl-geotiff/issues"
17
+ },
5
18
  "main": "dist/cjs/index.js",
6
19
  "module": "dist/esm/index.js",
7
20
  "type": "module",
8
21
  "types": "dist/index.d.ts",
9
22
  "sideEffects": false,
23
+ "files": [
24
+ "dist"
25
+ ],
26
+ "publishConfig": {
27
+ "access": "public"
28
+ },
29
+ "engines": {
30
+ "node": ">=16.0.0"
31
+ },
10
32
  "scripts": {
11
33
  "rollup": "rollup -c",
12
34
  "start": "yarn && yarn rollup",
13
- "lint": "eslint 'src/**/*.{js, ts,tsx}' -c ./.eslintrc.cjs",
14
- "lintFix": "eslint 'src/**/*.{js, ts,tsx}' -c ./.eslintrc.cjs --fix"
35
+ "lint": "eslint 'src/**/*.{js,ts,tsx}' -c ./.eslintrc.cjs",
36
+ "lintFix": "eslint 'src/**/*.{js,ts,tsx}' -c ./.eslintrc.cjs --fix"
15
37
  },
16
38
  "devDependencies": {
17
39
  "@rollup/plugin-commonjs": "^25.0.1",
@@ -29,13 +51,13 @@
29
51
  },
30
52
  "dependencies": {
31
53
  "@chunkd/source-http": "^11.1.0",
32
- "@cogeotiff/core": "^9.0.3",
33
54
  "@deck.gl/core": "^9.0.33",
34
55
  "@deck.gl/extensions": "^9.0.33",
35
56
  "@deck.gl/geo-layers": "^9.0.33",
36
57
  "@deck.gl/layers": "^9.0.33",
37
58
  "@deck.gl/mesh-layers": "^9.0.33",
38
59
  "@deck.gl/react": "^9.0.33",
60
+ "@deck.gl/widgets": "^9.0.33",
39
61
  "@loaders.gl/loader-utils": "^4.3.1",
40
62
  "@loaders.gl/schema": "^4.3.1",
41
63
  "@luma.gl/constants": "^9.0.27",
package/.eslintignore DELETED
@@ -1,2 +0,0 @@
1
- node_modules
2
- *.md
package/.eslintrc.cjs DELETED
@@ -1,3 +0,0 @@
1
- module.exports = {
2
- extends: ['../.eslintrc.cjs'],
3
- };
package/CHANGELOG.md DELETED
@@ -1,166 +0,0 @@
1
- # v1.9.2 (Wed Mar 06 2024)
2
-
3
- #### 🐾 Patch
4
-
5
- - Feature/fix terrain [#41](https://github.com/gisat-panther/deck.gl-geotiff/pull/41) ([@vdubr](https://github.com/vdubr))
6
-
7
- #### Authors: 1
8
-
9
- - Vojtěch Dubrovský ([@vdubr](https://github.com/vdubr))
10
-
11
- ---
12
-
13
- # v1.9.1 (Wed Jan 31 2024)
14
-
15
- #### 🐾 Patch
16
-
17
- - Feature/terrain options update [#40](https://github.com/gisat-panther/deck.gl-geotiff/pull/40) (mariana.kecova@gisat.cz [@MariDani](https://github.com/MariDani))
18
-
19
- #### Authors: 2
20
-
21
- - Mariana Kecová ([@MariDani](https://github.com/MariDani))
22
- - Mariana Kecova (mariana.kecova@gisat.cz)
23
-
24
- ---
25
-
26
- # v1.9.0 (Tue Dec 05 2023)
27
-
28
- #### 🚀 Enhancement
29
-
30
- - Color Classes Visualization [#39](https://github.com/gisat-panther/deck.gl-geotiff/pull/39) ([@vdubr](https://github.com/vdubr) mariana.kecova@gisat.cz [@MariDani](https://github.com/MariDani))
31
-
32
- #### 🐾 Patch
33
-
34
- - Bump package versions [#37](https://github.com/gisat-panther/deck.gl-geotiff/pull/37) ([@vdubr](https://github.com/vdubr))
35
-
36
- #### Authors: 3
37
-
38
- - Mariana Kecová ([@MariDani](https://github.com/MariDani))
39
- - Mariana Kecova (mariana.kecova@gisat.cz)
40
- - Vojtěch Dubrovský ([@vdubr](https://github.com/vdubr))
41
-
42
- ---
43
-
44
- # v1.8.1 (Thu Sep 21 2023)
45
-
46
- #### 🐾 Patch
47
-
48
- - added option to not use blurred textures [#36](https://github.com/gisat-panther/deck.gl-geotiff/pull/36) (mariana.kecova@gisat.cz [@MariDani](https://github.com/MariDani))
49
-
50
- #### Authors: 2
51
-
52
- - Mariana Kecová ([@MariDani](https://github.com/MariDani))
53
- - Mariana Kecova (mariana.kecova@gisat.cz)
54
-
55
- ---
56
-
57
- # v1.8.0 (Fri Aug 04 2023)
58
-
59
- #### 🚀 Enhancement
60
-
61
- - Feature/alpha visualization [#35](https://github.com/gisat-panther/deck.gl-geotiff/pull/35) (mariana.kecova@gisat.cz [@MariDani](https://github.com/MariDani))
62
-
63
- #### 🐾 Patch
64
-
65
- - Documentation [#34](https://github.com/gisat-panther/deck.gl-geotiff/pull/34) (mariana.kecova@gisat.cz [@MariDani](https://github.com/MariDani))
66
-
67
- #### Authors: 2
68
-
69
- - Mariana Kecová ([@MariDani](https://github.com/MariDani))
70
- - Mariana Kecova (mariana.kecova@gisat.cz)
71
-
72
- ---
73
-
74
- # v1.7.0 (Wed Jul 26 2023)
75
-
76
- #### 🚀 Enhancement
77
-
78
- - height images calculation updated [#33](https://github.com/gisat-panther/deck.gl-geotiff/pull/33) (mariana.kecova@gisat.cz [@MariDani](https://github.com/MariDani))
79
-
80
- #### 📝 Documentation
81
-
82
- - Documentation [#29](https://github.com/gisat-panther/deck.gl-geotiff/pull/29) (mariana.kecova@gisat.cz [@MariDani](https://github.com/MariDani))
83
-
84
- #### Authors: 2
85
-
86
- - Mariana Kecová ([@MariDani](https://github.com/MariDani))
87
- - Mariana Kecova (mariana.kecova@gisat.cz)
88
-
89
- ---
90
-
91
- # v1.6.0 (Mon Jun 26 2023)
92
-
93
- #### 🚀 Enhancement
94
-
95
- - Feature/terrain layer [#27](https://github.com/gisat-panther/deck.gl-geotiff/pull/27) ([@vdubr](https://github.com/vdubr) ci@example.com)
96
-
97
- #### Authors: 2
98
-
99
- - ci (ci@example.com)
100
- - Vojtěch Dubrovský ([@vdubr](https://github.com/vdubr))
101
-
102
- ---
103
-
104
- # v1.5.0 (Fri Jun 23 2023)
105
-
106
- #### 🚀 Enhancement
107
-
108
- - Feature/terrain layer [#24](https://github.com/gisat-panther/deck.gl-geotiff/pull/24) ([@vdubr](https://github.com/vdubr))
109
-
110
- #### 🐾 Patch
111
-
112
- - calculation of single channel rgb values updated [#23](https://github.com/gisat-panther/deck.gl-geotiff/pull/23) (mariana.kecova@gisat.cz [@MariDani](https://github.com/MariDani))
113
-
114
- #### Authors: 3
115
-
116
- - Mariana Kecová ([@MariDani](https://github.com/MariDani))
117
- - Mariana Kecova (mariana.kecova@gisat.cz)
118
- - Vojtěch Dubrovský ([@vdubr](https://github.com/vdubr))
119
-
120
- ---
121
-
122
- # v1.4.2 (Wed Jun 21 2023)
123
-
124
- #### 🐾 Patch
125
-
126
- - remove unused line [#22](https://github.com/gisat-panther/deck.gl-geotiff/pull/22) ([@vdubr](https://github.com/vdubr))
127
-
128
- #### Authors: 1
129
-
130
- - Vojtěch Dubrovský ([@vdubr](https://github.com/vdubr))
131
-
132
- ---
133
-
134
- # v1.4.1 (Tue Jun 20 2023)
135
-
136
- #### ⚠️ Pushed to `master`
137
-
138
- - Add lock changes ([@vdubr](https://github.com/vdubr))
139
- - Fix eslint ([@vdubr](https://github.com/vdubr))
140
-
141
- #### Authors: 1
142
-
143
- - Vojtěch Dubrovský ([@vdubr](https://github.com/vdubr))
144
-
145
- ---
146
-
147
- # v1.4.0 (Tue Jun 20 2023)
148
-
149
- #### 🚀 Enhancement
150
-
151
-
152
- #### Authors: 1
153
-
154
- - Vojtěch Dubrovský ([@vdubr](https://github.com/vdubr))
155
-
156
- ---
157
-
158
- # v1.2.0 (Mon Jun 19 2023)
159
-
160
- #### 🚀 Enhancement
161
-
162
-
163
- #### Authors: 2
164
-
165
- - Mariana Kecova (mariana.kecova@gisat.cz)
166
- - Vojtěch Dubrovský ([@vdubr](https://github.com/vdubr))
package/rollup.config.mjs DELETED
@@ -1,77 +0,0 @@
1
- import resolve from '@rollup/plugin-node-resolve';
2
- import commonjs from '@rollup/plugin-commonjs';
3
- import typescript from '@rollup/plugin-typescript';
4
- // import dts from 'rollup-plugin-dts';
5
- import { terser } from 'rollup-plugin-terser';
6
- import json from '@rollup/plugin-json';
7
- import filesize from 'rollup-plugin-filesize';
8
- import path from 'path';
9
-
10
- const packageJson = {
11
- main: './dist/cjs/',
12
- module: './dist/esm/',
13
- };
14
-
15
- export default [
16
- {
17
- external: [
18
- 'isomorphic-fetch',
19
- 'chroma-js',
20
- 'react',
21
- 'react-dom',
22
- '@deck.gl/core',
23
- '@deck.gl/extensions',
24
- '@deck.gl/geo-layers',
25
- '@deck.gl/layers',
26
- '@deck.gl/mesh-layers',
27
- '@luma.gl/constants',
28
- '@loaders.gl/schema',
29
- '@loaders.gl/loader-utils',
30
- ],
31
- input: './src/index.ts',
32
- output: [
33
- {
34
- file: path.join(packageJson.main, 'index.js'),
35
- format: 'cjs',
36
- sourcemap: true,
37
- inlineDynamicImports: true,
38
- },
39
- {
40
- file: path.join(packageJson.main, 'index.min.js'),
41
- format: 'cjs',
42
- sourcemap: true,
43
- plugins: [terser()],
44
- inlineDynamicImports: true,
45
- },
46
- {
47
- file: path.join(packageJson.module, 'index.js'),
48
- format: 'esm',
49
- sourcemap: true,
50
- inlineDynamicImports: true,
51
- },
52
- {
53
- file: path.join(packageJson.module, 'index.min.js'),
54
- format: 'esm',
55
- sourcemap: true,
56
- plugins: [terser()],
57
- inlineDynamicImports: true,
58
- },
59
- ],
60
- plugins: [
61
- json(),
62
- resolve({
63
- preferBuiltins: true,
64
- browser: true,
65
- }),
66
- commonjs(),
67
- typescript({ tsconfig: './tsconfig.json', exclude: ['**.js'] }),
68
- filesize(),
69
- ],
70
- },
71
- // {
72
- // input: 'dist/esm/types/index.d.ts',
73
- // output: [{ file: 'dist/index.d.ts', format: 'esm' }],
74
- // plugins: [dts()],
75
- // external: ['react', 'react-dom'],
76
- // },
77
- ];