@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
  };