@gisatcz/deckgl-geolib 2.4.1-dev.1 → 2.5.0-dev.1
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 +1 -0
- package/dist/cjs/index.js +421 -54
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/index.min.js +2 -2
- package/dist/cjs/index.min.js.map +1 -1
- package/dist/esm/index.js +421 -54
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.min.js +2 -2
- package/dist/esm/index.min.js.map +1 -1
- package/dist/esm/types/core/CogTiles.d.ts +2 -2
- package/dist/esm/types/core/GeoImage.d.ts +2 -0
- package/dist/esm/types/core/lib/BitmapGenerator.d.ts +21 -1
- package/dist/esm/types/core/lib/KernelGenerator.d.ts +12 -0
- package/dist/esm/types/core/lib/ReliefCompositor.d.ts +28 -0
- package/dist/esm/types/core/lib/TerrainGenerator.d.ts +6 -1
- package/dist/esm/types/core/types.d.ts +9 -0
- package/package.json +1 -1
|
@@ -50,7 +50,7 @@ declare class CogTiles {
|
|
|
50
50
|
* @returns {number} The index of the image in the COG that best matches the specified zoom level.
|
|
51
51
|
*/
|
|
52
52
|
getImageIndexForZoomLevel(zoom: number): number;
|
|
53
|
-
getTileFromImage(tileX: number, tileY: number, zoom: number, fetchSize?: number): Promise<(
|
|
53
|
+
getTileFromImage(tileX: number, tileY: number, zoom: number, fetchSize?: number): Promise<(Uint8Array<ArrayBuffer> | Float32Array<ArrayBuffer> | Int8Array<ArrayBuffer> | Int16Array<ArrayBuffer> | Uint16Array<ArrayBuffer> | Int32Array<ArrayBuffer> | Uint32Array<ArrayBuffer> | Float64Array<ArrayBuffer>)[] | import("geotiff").TypedArrayWithDimensions[]>;
|
|
54
54
|
/**
|
|
55
55
|
* Creates a blank tile buffer filled with the "No Data" value.
|
|
56
56
|
* @param size The width/height of the square tile (e.g., 256 or 257)
|
|
@@ -81,6 +81,6 @@ declare class CogTiles {
|
|
|
81
81
|
* @param {number} multiplier - Optional multiplier for interleaved buffers (e.g., numChannels).
|
|
82
82
|
* @returns {TypedArray} A typed array buffer of length (tileSize * tileSize * multiplier).
|
|
83
83
|
*/
|
|
84
|
-
createTileBuffer(dataType: string, tileSize: number, multiplier?: number):
|
|
84
|
+
createTileBuffer(dataType: string, tileSize: number, multiplier?: number): Uint8Array<ArrayBuffer> | Float32Array<ArrayBuffer> | Int8Array<ArrayBuffer> | Int16Array<ArrayBuffer> | Uint16Array<ArrayBuffer> | Int32Array<ArrayBuffer> | Uint32Array<ArrayBuffer> | Float64Array<ArrayBuffer>;
|
|
85
85
|
}
|
|
86
86
|
export default CogTiles;
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { GeoImageOptions, TypedArray, TileResult } from '../types';
|
|
2
2
|
export declare class BitmapGenerator {
|
|
3
|
+
/**
|
|
4
|
+
* Cache for Swiss relief color LUTs to avoid regenerating on every tile.
|
|
5
|
+
* Key: colorScale config + range, Value: pre-computed RGBA LUT
|
|
6
|
+
*/
|
|
7
|
+
private static _swissColorLUTCache;
|
|
3
8
|
/**
|
|
4
9
|
* Main entry point: Generates an ImageBitmap from raw raster data.
|
|
5
10
|
*/
|
|
@@ -8,7 +13,22 @@ export declare class BitmapGenerator {
|
|
|
8
13
|
height: number;
|
|
9
14
|
rasters: TypedArray[];
|
|
10
15
|
}, options: GeoImageOptions): Promise<TileResult>;
|
|
11
|
-
static getColorValue(dataArray: TypedArray |
|
|
16
|
+
static getColorValue(dataArray: TypedArray | TypedArray[], options: GeoImageOptions, arrayLength: number, samplesPerPixel?: number): Uint8ClampedArray<ArrayBuffer>;
|
|
17
|
+
/**
|
|
18
|
+
* Generate relief glaze RGBA output.
|
|
19
|
+
* Maps relief mask (0-255) to pure black/white glaze with variable alpha.
|
|
20
|
+
* - reliefValue < 128: Pure black (0,0,0) darkens shadows
|
|
21
|
+
* - reliefValue > 128: Pure white (255,255,255) brightens highlights
|
|
22
|
+
* - reliefValue == 128: Transparent (no effect)
|
|
23
|
+
*
|
|
24
|
+
* High-performance implementation using pre-computed alpha LUT to avoid 65k Math.pow calls.
|
|
25
|
+
*
|
|
26
|
+
* @param rasters Array of [relief mask raster] (single raster expected)
|
|
27
|
+
* @param options GeoImageOptions (alpha used for opacity scaling)
|
|
28
|
+
* @param arrayLength Total RGBA array length
|
|
29
|
+
* @returns Uint8ClampedArray of RGBA values
|
|
30
|
+
*/
|
|
31
|
+
static getReliefGlazeRGBA(rasters: TypedArray[], options: GeoImageOptions, arrayLength: number): Uint8ClampedArray;
|
|
12
32
|
private static calculateSingleColor;
|
|
13
33
|
private static findClassIndex;
|
|
14
34
|
private static getDefaultColor;
|
|
@@ -7,6 +7,13 @@
|
|
|
7
7
|
* Output: Float32Array of 256×256 computed values.
|
|
8
8
|
*/
|
|
9
9
|
export declare class KernelGenerator {
|
|
10
|
+
/**
|
|
11
|
+
* Compute terrain gradients (dzdx, dzdy) using Horn's method.
|
|
12
|
+
* @param z1-z9 - 3×3 neighborhood elevation values (z5 is center)
|
|
13
|
+
* @param cellSizeFactor - Pre-computed 1 / (8 * cellSize)
|
|
14
|
+
* @param geographicConvention - If true, use north-minus-south for dzdy (hillshade). If false, use south-minus-north (slope).
|
|
15
|
+
*/
|
|
16
|
+
private static computeGradients;
|
|
10
17
|
/**
|
|
11
18
|
* Calculates slope (0–90 degrees) for each pixel using Horn's method.
|
|
12
19
|
*
|
|
@@ -28,4 +35,9 @@ export declare class KernelGenerator {
|
|
|
28
35
|
* @param noDataValue Elevation value treated as noData; output is NaN for those pixels
|
|
29
36
|
*/
|
|
30
37
|
static calculateHillshade(src: Float32Array, cellSize: number, azimuth?: number, altitude?: number, zFactor?: number, noDataValue?: number): Float32Array;
|
|
38
|
+
/**
|
|
39
|
+
* Calculates a weighted multi-directional hillshade (0–255).
|
|
40
|
+
* Combines three light sources to reveal structure in shadows.
|
|
41
|
+
*/
|
|
42
|
+
static calculateMultiHillshade(src: Float32Array, cellSize: number, zFactor?: number, noDataValue?: number): Float32Array;
|
|
31
43
|
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { GeoImageOptions } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Composes Swiss relief by combining slope and hillshade kernels via LUT.
|
|
4
|
+
* Outputs a single 0-255 relief mask suitable for baking into hypsometry (terrain)
|
|
5
|
+
* or creating transparent glaze overlays (bitmap).
|
|
6
|
+
*/
|
|
7
|
+
export declare class ReliefCompositor {
|
|
8
|
+
/**
|
|
9
|
+
* Precompute and cache a 256x256 LUT for Swiss relief compositing.
|
|
10
|
+
* LUT[hillshade][slope] = (hillshade * (1.0 - (slope * weight)))
|
|
11
|
+
* All values normalized to [0,1].
|
|
12
|
+
* Only computed on first use of Swiss relief mode.
|
|
13
|
+
*/
|
|
14
|
+
private static _swissReliefLUT;
|
|
15
|
+
private static _lastWeight;
|
|
16
|
+
static getSwissReliefLUT(weight?: number): Float32Array;
|
|
17
|
+
/**
|
|
18
|
+
* Compute Swiss relief compositing: slope + hillshade → 0-255 relief mask.
|
|
19
|
+
*
|
|
20
|
+
* @param elevation - Padded elevation raster (258×258 for kernel input)
|
|
21
|
+
* @param options - GeoImageOptions (must include zFactor, noDataValue, swissSlopeWeight)
|
|
22
|
+
* @param cellSize - Grid cell size in meters
|
|
23
|
+
* @param width - Output width (typically 256)
|
|
24
|
+
* @param height - Output height (typically 256)
|
|
25
|
+
* @returns Uint8ClampedArray of 0-255 relief values
|
|
26
|
+
*/
|
|
27
|
+
static composeSwissRelief(elevation: Float32Array, options: GeoImageOptions, cellSize: number, width: number, height: number): Uint8ClampedArray;
|
|
28
|
+
}
|
|
@@ -7,9 +7,14 @@ export declare class TerrainGenerator {
|
|
|
7
7
|
bounds: Bounds;
|
|
8
8
|
cellSizeMeters?: number;
|
|
9
9
|
}, options: GeoImageOptions, meshMaxError: number): Promise<TileResult>;
|
|
10
|
-
/** Extracts rows 1–257, cols 1–257 from a 258×258 terrain array → 257×257 for mesh generation. */
|
|
11
10
|
private static extractMeshRaster;
|
|
12
11
|
private static hasVisualizationOptions;
|
|
12
|
+
/**
|
|
13
|
+
* Preserve noData values in a separate raster for kernel computation.
|
|
14
|
+
* If the source raster marks a sample as noData, keep it as noData.
|
|
15
|
+
* Otherwise, use the processed terrain elevation value.
|
|
16
|
+
*/
|
|
17
|
+
private static preserveNoDataForKernel;
|
|
13
18
|
private static cropRaster;
|
|
14
19
|
/**
|
|
15
20
|
* Decodes raw raster data into a Float32Array of elevation values.
|
|
@@ -41,7 +41,10 @@ export type GeoImageOptions = {
|
|
|
41
41
|
colorScaleValueRange?: number[];
|
|
42
42
|
colorsBasedOnValues?: Array<[number, ChromaColorInput]>;
|
|
43
43
|
colorClasses?: Array<[ChromaColorInput, [number, number], [boolean?, boolean?]?]>;
|
|
44
|
+
/** General layer opacity (0-100). Used for all rendering modes except glaze. */
|
|
44
45
|
alpha?: number;
|
|
46
|
+
/** Intensity ceiling for the relief glaze (0-255). 0 is fully transparent; 255 is maximum theoretical opacity. Recommended range for satellite overlays: 120-160. Only used with useReliefGlaze. */
|
|
47
|
+
maxGlazeAlpha?: number;
|
|
45
48
|
nullColor?: ChromaColorInput;
|
|
46
49
|
unidentifiedColor?: ChromaColorInput;
|
|
47
50
|
clippedColor?: ChromaColorInput;
|
|
@@ -51,6 +54,10 @@ export type GeoImageOptions = {
|
|
|
51
54
|
hillshadeAzimuth?: number;
|
|
52
55
|
hillshadeAltitude?: number;
|
|
53
56
|
zFactor?: number;
|
|
57
|
+
useSwissRelief?: boolean;
|
|
58
|
+
swissSlopeWeight?: number;
|
|
59
|
+
useReliefGlaze?: boolean;
|
|
60
|
+
disableLighting?: boolean;
|
|
54
61
|
};
|
|
55
62
|
export declare const DefaultGeoImageOptions: GeoImageOptions;
|
|
56
63
|
export type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array;
|
|
@@ -74,4 +81,6 @@ export interface TileResult {
|
|
|
74
81
|
width: number;
|
|
75
82
|
height: number;
|
|
76
83
|
texture?: ImageBitmap;
|
|
84
|
+
/** Optional: grayscale or color bitmap for Swiss relief or other overlays */
|
|
85
|
+
bitmap?: Uint8ClampedArray | ImageBitmap;
|
|
77
86
|
}
|