@gisatcz/deckgl-geolib 2.3.1-dev.1 → 2.4.0-dev.2
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 +35 -5
- package/dist/cjs/index.js +496 -339
- 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 +496 -339
- 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/GeoImage.d.ts +2 -0
- package/dist/esm/types/core/lib/BitmapGenerator.d.ts +11 -6
- package/dist/esm/types/core/lib/KernelGenerator.d.ts +31 -0
- package/dist/esm/types/core/lib/TerrainGenerator.d.ts +6 -1
- package/dist/esm/types/core/types.d.ts +27 -19
- package/dist/esm/types/layers/CogTerrainLayer.d.ts +6 -0
- package/package.json +1 -1
|
@@ -9,12 +9,14 @@ export default class GeoImage {
|
|
|
9
9
|
height: number;
|
|
10
10
|
rasters: any[];
|
|
11
11
|
bounds: Bounds;
|
|
12
|
+
cellSizeMeters?: number;
|
|
12
13
|
}, options: GeoImageOptions, meshMaxError: any): Promise<TileResult | null>;
|
|
13
14
|
getHeightmap(input: string | {
|
|
14
15
|
bounds: Bounds;
|
|
15
16
|
width: number;
|
|
16
17
|
height: number;
|
|
17
18
|
rasters: any[];
|
|
19
|
+
cellSizeMeters?: number;
|
|
18
20
|
}, options: GeoImageOptions, meshMaxError: any): Promise<TileResult>;
|
|
19
21
|
getBitmap(input: string | {
|
|
20
22
|
width: number;
|
|
@@ -1,15 +1,20 @@
|
|
|
1
|
-
import chroma from 'chroma-js';
|
|
2
1
|
import { GeoImageOptions, TypedArray, TileResult } from '../types';
|
|
3
2
|
export declare class BitmapGenerator {
|
|
3
|
+
/**
|
|
4
|
+
* Main entry point: Generates an ImageBitmap from raw raster data.
|
|
5
|
+
*/
|
|
4
6
|
static generate(input: {
|
|
5
7
|
width: number;
|
|
6
8
|
height: number;
|
|
7
9
|
rasters: TypedArray[];
|
|
8
10
|
}, options: GeoImageOptions): Promise<TileResult>;
|
|
9
|
-
static getMinMax(array: TypedArray, options: GeoImageOptions, samplesPerPixel?: number): number[];
|
|
10
11
|
static getColorValue(dataArray: TypedArray | any[], options: GeoImageOptions, arrayLength: number, samplesPerPixel?: number): Uint8ClampedArray<ArrayBuffer>;
|
|
11
|
-
static
|
|
12
|
-
static
|
|
13
|
-
static
|
|
14
|
-
static
|
|
12
|
+
private static calculateSingleColor;
|
|
13
|
+
private static findClassIndex;
|
|
14
|
+
private static getDefaultColor;
|
|
15
|
+
private static isInvalid;
|
|
16
|
+
private static getInvalidColor;
|
|
17
|
+
static getMinMax(array: TypedArray, options: GeoImageOptions, samplesPerPixel?: number): number[];
|
|
18
|
+
static getColorFromChromaType(color: any, alpha?: number): any[];
|
|
19
|
+
static hasPixelsNoData(pixels: number[], noData: number | undefined): boolean;
|
|
15
20
|
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* KernelGenerator — 3×3 neighborhood kernel calculations on elevation rasters.
|
|
3
|
+
*
|
|
4
|
+
* Input contract: a Float32Array of 258×258 elevation values (row-major).
|
|
5
|
+
* Edge pixels (row/col 0 and 257) are used only as kernel neighbors and do
|
|
6
|
+
* not appear in the output.
|
|
7
|
+
* Output: Float32Array of 256×256 computed values.
|
|
8
|
+
*/
|
|
9
|
+
export declare class KernelGenerator {
|
|
10
|
+
/**
|
|
11
|
+
* Calculates slope (0–90 degrees) for each pixel using Horn's method.
|
|
12
|
+
*
|
|
13
|
+
* @param src Float32Array of 258×258 elevation values (row-major)
|
|
14
|
+
* @param cellSize Cell size in meters per pixel
|
|
15
|
+
* @param zFactor Vertical exaggeration factor (default 1)
|
|
16
|
+
* @param noDataValue Elevation value treated as noData; output is NaN for those pixels
|
|
17
|
+
*/
|
|
18
|
+
static calculateSlope(src: Float32Array, cellSize: number, zFactor?: number, noDataValue?: number): Float32Array;
|
|
19
|
+
/**
|
|
20
|
+
* Calculates hillshade (0–255 grayscale) for each pixel.
|
|
21
|
+
* Follows the ESRI hillshade algorithm convention.
|
|
22
|
+
*
|
|
23
|
+
* @param src Float32Array of 258×258 elevation values (row-major)
|
|
24
|
+
* @param azimuth Sun azimuth in degrees (default 315 = NW)
|
|
25
|
+
* @param altitude Sun altitude above horizon in degrees (default 45)
|
|
26
|
+
* @param cellSize Cell size in meters per pixel
|
|
27
|
+
* @param zFactor Vertical exaggeration factor (default 1)
|
|
28
|
+
* @param noDataValue Elevation value treated as noData; output is NaN for those pixels
|
|
29
|
+
*/
|
|
30
|
+
static calculateHillshade(src: Float32Array, cellSize: number, azimuth?: number, altitude?: number, zFactor?: number, noDataValue?: number): Float32Array;
|
|
31
|
+
}
|
|
@@ -5,7 +5,12 @@ export declare class TerrainGenerator {
|
|
|
5
5
|
height: number;
|
|
6
6
|
rasters: TypedArray[];
|
|
7
7
|
bounds: Bounds;
|
|
8
|
-
|
|
8
|
+
cellSizeMeters?: number;
|
|
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
|
+
private static extractMeshRaster;
|
|
12
|
+
private static hasVisualizationOptions;
|
|
13
|
+
private static cropRaster;
|
|
9
14
|
/**
|
|
10
15
|
* Decodes raw raster data into a Float32Array of elevation values.
|
|
11
16
|
* Handles channel selection, value scaling, data type validation, and border stitching.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import chroma from 'chroma-js';
|
|
2
|
+
export type ChromaColorInput = string | number[] | chroma.Color;
|
|
2
3
|
import type { MeshAttributes } from '@loaders.gl/schema';
|
|
3
4
|
export type Bounds = [minX: number, minY: number, maxX: number, maxY: number];
|
|
4
5
|
export type ClampToTerrainOptions = {
|
|
@@ -6,38 +7,43 @@ export type ClampToTerrainOptions = {
|
|
|
6
7
|
};
|
|
7
8
|
export type GeoImageOptions = {
|
|
8
9
|
type: 'image' | 'terrain';
|
|
9
|
-
tesselator?: 'martini' | 'delatin';
|
|
10
10
|
format?: 'uint8' | 'uint16' | 'uint32' | 'int8' | 'int16' | 'int32' | 'float32' | 'float64';
|
|
11
|
+
/** 1-based index of the channel to visualize (e.g. 1 for the first channel). */
|
|
12
|
+
useChannel?: number | null;
|
|
13
|
+
/** 0-based index of the channel to visualize (e.g. 0 for the first channel). Alternative to useChannel. */
|
|
14
|
+
useChannelIndex?: number | null;
|
|
15
|
+
noDataValue?: number;
|
|
16
|
+
multiplier?: number;
|
|
17
|
+
numOfChannels?: number;
|
|
18
|
+
planarConfig?: number;
|
|
19
|
+
tesselator?: 'martini' | 'delatin';
|
|
20
|
+
terrainColor?: Array<number> | chroma.Color;
|
|
21
|
+
terrainSkirtHeight?: number;
|
|
22
|
+
terrainMinValue?: number;
|
|
11
23
|
useHeatMap?: boolean;
|
|
12
24
|
useColorsBasedOnValues?: boolean;
|
|
13
25
|
useColorClasses?: boolean;
|
|
14
26
|
useAutoRange?: boolean;
|
|
15
27
|
useDataForOpacity?: boolean;
|
|
16
|
-
/** 1-based index of the channel to visualize (e.g. 1 for the first channel). */
|
|
17
|
-
useChannel?: number | null;
|
|
18
|
-
/** 0-based index of the channel to visualize (e.g. 0 for the first channel). Alternative to useChannel. */
|
|
19
|
-
useChannelIndex?: number | null;
|
|
20
28
|
useSingleColor?: boolean;
|
|
21
29
|
blurredTexture?: boolean;
|
|
22
30
|
clipLow?: number | null;
|
|
23
31
|
clipHigh?: number | null;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
colorScale?: Array<string> | Array<chroma.Color>;
|
|
32
|
+
color?: ChromaColorInput;
|
|
33
|
+
colorScale?: ChromaColorInput[];
|
|
27
34
|
colorScaleValueRange?: number[];
|
|
28
|
-
colorsBasedOnValues?: [number
|
|
29
|
-
colorClasses?: [
|
|
35
|
+
colorsBasedOnValues?: Array<[number, ChromaColorInput]>;
|
|
36
|
+
colorClasses?: Array<[ChromaColorInput, [number, number], [boolean?, boolean?]?]>;
|
|
30
37
|
alpha?: number;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
unidentifiedColor?: Array<number> | chroma.Color;
|
|
35
|
-
clippedColor?: Array<number> | chroma.Color;
|
|
38
|
+
nullColor?: ChromaColorInput;
|
|
39
|
+
unidentifiedColor?: ChromaColorInput;
|
|
40
|
+
clippedColor?: ChromaColorInput;
|
|
36
41
|
clampToTerrain?: ClampToTerrainOptions | boolean;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
42
|
+
useSlope?: boolean;
|
|
43
|
+
useHillshade?: boolean;
|
|
44
|
+
hillshadeAzimuth?: number;
|
|
45
|
+
hillshadeAltitude?: number;
|
|
46
|
+
zFactor?: number;
|
|
41
47
|
};
|
|
42
48
|
export declare const DefaultGeoImageOptions: GeoImageOptions;
|
|
43
49
|
export type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array;
|
|
@@ -57,6 +63,8 @@ export type TerrainMesh = {
|
|
|
57
63
|
export interface TileResult {
|
|
58
64
|
map: ImageBitmap | TerrainMesh;
|
|
59
65
|
raw: TypedArray | null;
|
|
66
|
+
rawDerived?: TypedArray | null;
|
|
60
67
|
width: number;
|
|
61
68
|
height: number;
|
|
69
|
+
texture?: ImageBitmap;
|
|
62
70
|
}
|
|
@@ -55,6 +55,12 @@ type _CogTerrainLayerProps = {
|
|
|
55
55
|
terrainOptions: GeoImageOptions;
|
|
56
56
|
/** Pre-initialized CogTiles object for terrain */
|
|
57
57
|
cogTiles?: CogTiles;
|
|
58
|
+
/**
|
|
59
|
+
* When true, suppresses any texture generated by the tile (e.g. heatmap/hillshade)
|
|
60
|
+
* and renders the mesh in the plain `color` instead.
|
|
61
|
+
* Useful for showing a neutral grey terrain during mode transitions.
|
|
62
|
+
*/
|
|
63
|
+
disableTexture?: boolean;
|
|
58
64
|
/**
|
|
59
65
|
* @deprecated Use `loadOptions.terrain.workerUrl` instead
|
|
60
66
|
*/
|