@gisatcz/deckgl-geolib 2.6.0-dev.1 → 2.6.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.
@@ -1,4 +1,6 @@
1
1
  export { CogBitmapLayer, CogTerrainLayer } from './layers/index';
2
2
  export { CogTiles, GeoImage } from './core/index';
3
3
  export { suppressGlobalAbortErrors } from './utils/suppressAbortErrors';
4
+ export { extractTerrainCoordinate, sampleTerrainTileCoordinates } from './utils/terrainPickingUtils';
4
5
  export type { GeoImageOptions } from './core/index';
6
+ export type { TerrainCoordinate } from './utils/terrainPickingUtils';
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Terrain coordinate extraction utility for CogTerrainLayer
3
+ * Enables precise lat/lon/elevation extraction from 3D terrain picks
4
+ */
5
+ /**
6
+ * Represents a geographic coordinate with elevation from terrain picking
7
+ */
8
+ export interface TerrainCoordinate {
9
+ /** Longitude in degrees */
10
+ longitude: number;
11
+ /** Latitude in degrees */
12
+ latitude: number;
13
+ /** Elevation in meters */
14
+ elevation: number;
15
+ }
16
+ /**
17
+ * Extracts precise geographic coordinates and elevation from a CogTerrainLayer pick result
18
+ *
19
+ * @param pickResult - DeckGL pickObject result from terrain-layer pick
20
+ * @returns TerrainCoordinate with lon/lat/elevation, or null if extraction fails
21
+ *
22
+ * @requires deck.gl >=9.3.0 (for `pickable: '3d'` support)
23
+ * @note Requires `pickable: '3d'` on CogTerrainLayer. With 3D picking enabled,
24
+ * deck.gl's terrain layer provides info.coordinate as a 3-element array [lon, lat, elevation]
25
+ * where elevation is read directly from the terrain mesh at the picked point.
26
+ * This gives accurate 3D coordinates regardless of camera pitch or bearing.
27
+ *
28
+ * @example
29
+ * ```ts
30
+ * const cogLayer = new CogTerrainLayer({
31
+ * // ...
32
+ * pickable: '3d', // Requires deck.gl >=9.3.0
33
+ * onClick: (info) => {
34
+ * const coord = extractTerrainCoordinate(info);
35
+ * if (coord) {
36
+ * console.log(`Clicked at ${coord.latitude}, ${coord.longitude}, elevation: ${coord.elevation}m`);
37
+ * }
38
+ * }
39
+ * });
40
+ * ```
41
+ */
42
+ export declare function extractTerrainCoordinate(pickResult: any): TerrainCoordinate | null;
43
+ /**
44
+ * Samples terrain coordinates in a grid around a pick point for debugging
45
+ * Useful for understanding terrain data layout and accuracy
46
+ *
47
+ * @param pickResult - DeckGL pickObject result from terrain-layer pick
48
+ * @param gridSize - Odd number for grid dimensions (default: 3 for 3x3 grid).
49
+ * gridSize=3 → 3×3 grid (offset±1), gridSize=5 → 5×5 grid (offset±2).
50
+ * Uses WebMercator projection for accurate latitude mapping.
51
+ * @returns Array of TerrainCoordinate samples, or empty array if extraction fails
52
+ *
53
+ * @example
54
+ * ```ts
55
+ * const samples = sampleTerrainTileCoordinates(info, 5); // 5x5 grid around click
56
+ * samples.forEach(coord => {
57
+ * console.log(`Sample: ${coord.latitude}, ${coord.longitude}, elev: ${coord.elevation}m`);
58
+ * });
59
+ * ```
60
+ */
61
+ export declare function sampleTerrainTileCoordinates(pickResult: any, gridSize?: number): TerrainCoordinate[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gisatcz/deckgl-geolib",
3
- "version": "2.6.0-dev.1",
3
+ "version": "2.6.0-dev.2",
4
4
  "description": "Deck.gl extension for rendering Cloud-Optimized GeoTIFF (COG) data",
5
5
  "keywords": [
6
6
  "deck.gl",
@@ -67,17 +67,17 @@
67
67
  "@luma.gl/shadertools": ">=9.0.0"
68
68
  },
69
69
  "devDependencies": {
70
- "@deck.gl/core": "^9.2.11",
71
- "@deck.gl/extensions": "^9.2.11",
72
- "@deck.gl/geo-layers": "^9.2.11",
73
- "@deck.gl/layers": "^9.2.11",
74
- "@deck.gl/mesh-layers": "^9.2.11",
75
- "@loaders.gl/core": "^4.3.4",
76
- "@loaders.gl/loader-utils": "^4.3.4",
77
- "@loaders.gl/schema": "^4.3.4",
78
- "@luma.gl/core": "^9.2.6",
79
- "@luma.gl/engine": "^9.2.6",
80
- "@luma.gl/shadertools": "^9.2.6",
70
+ "@deck.gl/core": "^9.3.2",
71
+ "@deck.gl/extensions": "^9.3.2",
72
+ "@deck.gl/geo-layers": "^9.3.2",
73
+ "@deck.gl/layers": "^9.3.2",
74
+ "@deck.gl/mesh-layers": "^9.3.2",
75
+ "@loaders.gl/core": "^4.4.1",
76
+ "@loaders.gl/loader-utils": "^4.4.1",
77
+ "@loaders.gl/schema": "^4.4.1",
78
+ "@luma.gl/core": "^9.3.3",
79
+ "@luma.gl/engine": "^9.3.3",
80
+ "@luma.gl/shadertools": "^9.3.3",
81
81
  "@rollup/plugin-commonjs": "^29.0.2",
82
82
  "@rollup/plugin-json": "^6.1.0",
83
83
  "@rollup/plugin-node-resolve": "^16.0.3",