maplibre-gl-lidar 0.1.0 → 0.2.0

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.
Files changed (45) hide show
  1. package/README.md +69 -0
  2. package/dist/{LidarControl-CQjIl4U5.cjs → LidarLayerAdapter-AsxiD9q_.cjs} +650 -28
  3. package/dist/LidarLayerAdapter-AsxiD9q_.cjs.map +1 -0
  4. package/dist/{LidarControl-BFJN1DIQ.js → LidarLayerAdapter-C-CjgaZ_.js} +657 -35
  5. package/dist/LidarLayerAdapter-C-CjgaZ_.js.map +1 -0
  6. package/dist/index.cjs +19 -18
  7. package/dist/index.cjs.map +1 -1
  8. package/dist/index.mjs +9 -8
  9. package/dist/maplibre-gl-lidar.css +115 -14
  10. package/dist/react.cjs +18 -4
  11. package/dist/react.cjs.map +1 -1
  12. package/dist/react.mjs +17 -2
  13. package/dist/react.mjs.map +1 -1
  14. package/dist/types/index.d.ts +1 -0
  15. package/dist/types/index.d.ts.map +1 -1
  16. package/dist/types/lib/adapters/LidarLayerAdapter.d.ts +108 -0
  17. package/dist/types/lib/adapters/LidarLayerAdapter.d.ts.map +1 -0
  18. package/dist/types/lib/adapters/index.d.ts +2 -0
  19. package/dist/types/lib/adapters/index.d.ts.map +1 -0
  20. package/dist/types/lib/colorizers/ColorScheme.d.ts +18 -0
  21. package/dist/types/lib/colorizers/ColorScheme.d.ts.map +1 -1
  22. package/dist/types/lib/colorizers/index.d.ts +2 -1
  23. package/dist/types/lib/colorizers/index.d.ts.map +1 -1
  24. package/dist/types/lib/core/LidarControl.d.ts +61 -0
  25. package/dist/types/lib/core/LidarControl.d.ts.map +1 -1
  26. package/dist/types/lib/core/LidarControlReact.d.ts +1 -1
  27. package/dist/types/lib/core/LidarControlReact.d.ts.map +1 -1
  28. package/dist/types/lib/core/types.d.ts +20 -0
  29. package/dist/types/lib/core/types.d.ts.map +1 -1
  30. package/dist/types/lib/gui/ClassificationLegend.d.ts +66 -0
  31. package/dist/types/lib/gui/ClassificationLegend.d.ts.map +1 -0
  32. package/dist/types/lib/gui/PanelBuilder.d.ts +11 -2
  33. package/dist/types/lib/gui/PanelBuilder.d.ts.map +1 -1
  34. package/dist/types/lib/gui/index.d.ts +2 -0
  35. package/dist/types/lib/gui/index.d.ts.map +1 -1
  36. package/dist/types/lib/hooks/useLidarState.d.ts.map +1 -1
  37. package/dist/types/lib/layers/PointCloudManager.d.ts +34 -0
  38. package/dist/types/lib/layers/PointCloudManager.d.ts.map +1 -1
  39. package/dist/types/lib/layers/types.d.ts +4 -0
  40. package/dist/types/lib/layers/types.d.ts.map +1 -1
  41. package/dist/types/react.d.ts +3 -1
  42. package/dist/types/react.d.ts.map +1 -1
  43. package/package.json +2 -1
  44. package/dist/LidarControl-BFJN1DIQ.js.map +0 -1
  45. package/dist/LidarControl-CQjIl4U5.cjs.map +0 -1
package/README.md CHANGED
@@ -2,11 +2,15 @@
2
2
 
3
3
  A MapLibre GL JS plugin for visualizing LiDAR point clouds using deck.gl.
4
4
 
5
+ [![npm version](https://img.shields.io/npm/v/maplibre-gl-lidar.svg)](https://www.npmjs.com/package/maplibre-gl-lidar)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7
+
5
8
  ## Features
6
9
 
7
10
  - Load and visualize LAS/LAZ/COPC point cloud files (LAS 1.0 - 1.4)
8
11
  - **Dynamic COPC streaming** - viewport-based loading for large cloud-optimized point clouds
9
12
  - Multiple color schemes: elevation, intensity, classification, RGB
13
+ - **Classification legend with toggle** - interactive legend to show/hide individual classification types
10
14
  - **Percentile-based coloring** - use 2-98% percentile range for better color distribution (clips outliers)
11
15
  - Interactive GUI control panel with scrollable content
12
16
  - **Point picking** - hover over points to see all available attributes (coordinates, elevation, intensity, classification, RGB, GPS time, return number, etc.)
@@ -18,6 +22,12 @@ A MapLibre GL JS plugin for visualizing LiDAR point clouds using deck.gl.
18
22
  - deck.gl PointCloudLayer with optimized chunking for large datasets
19
23
  - TypeScript support
20
24
 
25
+ ## Demo
26
+
27
+ Try the [live demo](https://opengeos.org/maplibre-gl-lidar).
28
+
29
+ ![](https://github.com/user-attachments/assets/db03b60d-918d-438d-9f3f-1f922b1a0a2b)
30
+
21
31
  ## Installation
22
32
 
23
33
  ```bash
@@ -107,6 +117,7 @@ function App() {
107
117
  pointSize={state.pointSize}
108
118
  colorScheme={state.colorScheme}
109
119
  onLoad={(pc) => console.log('Loaded:', pc)}
120
+ defaultUrl="https://s3.amazonaws.com/hobu-lidar/autzen-classified.copc.laz"
110
121
  />
111
122
  )}
112
123
  </div>
@@ -189,6 +200,13 @@ getZOffset(): number
189
200
  setPickInfoFields(fields?: string[]): void
190
201
  getPickInfoFields(): string[] | undefined
191
202
 
203
+ // Classification visibility (when using 'classification' color scheme)
204
+ setClassificationVisibility(code: number, visible: boolean): void
205
+ showAllClassifications(): void
206
+ hideAllClassifications(): void
207
+ getHiddenClassifications(): number[]
208
+ getAvailableClassifications(): number[]
209
+
192
210
  // Panel control
193
211
  toggle(): void
194
212
  expand(): void
@@ -293,6 +311,57 @@ console.log(control.getZOffset()); // 50
293
311
 
294
312
  The Z offset can also be adjusted interactively via the "Z Offset" checkbox and slider in the GUI panel.
295
313
 
314
+ ### Classification Legend
315
+
316
+ When using the "Classification" color scheme, an interactive legend appears showing all classification types found in the point cloud data. Each classification displays:
317
+
318
+ - A color swatch matching the ASPRS standard colors
319
+ - The classification name (Ground, Building, Vegetation, etc.)
320
+ - A checkbox to toggle visibility
321
+
322
+ **Features:**
323
+ - **Show All / Hide All buttons** - Quickly toggle all classifications at once
324
+ - **Individual toggles** - Show or hide specific classification types
325
+ - **Auto-detection** - Classifications are automatically detected from loaded data
326
+ - **Streaming support** - Classifications update as data streams in for COPC files
327
+
328
+ ```typescript
329
+ // Via GUI: Select "Classification" from the Color By dropdown
330
+ // The legend automatically appears with checkboxes for each class
331
+
332
+ // Programmatically control visibility
333
+ control.setColorScheme('classification');
334
+
335
+ // Hide specific classifications (e.g., hide noise points)
336
+ control.setClassificationVisibility(7, false); // Hide "Low Point (Noise)"
337
+ control.setClassificationVisibility(18, false); // Hide "High Noise"
338
+
339
+ // Show only ground and buildings
340
+ control.hideAllClassifications();
341
+ control.setClassificationVisibility(2, true); // Ground
342
+ control.setClassificationVisibility(6, true); // Building
343
+
344
+ // Get available classifications in the data
345
+ const available = control.getAvailableClassifications();
346
+ console.log('Classifications:', available); // [2, 3, 4, 5, 6, ...]
347
+
348
+ // Get currently hidden classifications
349
+ const hidden = control.getHiddenClassifications();
350
+ console.log('Hidden:', hidden); // [7, 18]
351
+ ```
352
+
353
+ **ASPRS Classification Codes:**
354
+ | Code | Name |
355
+ |------|------|
356
+ | 2 | Ground |
357
+ | 3 | Low Vegetation |
358
+ | 4 | Medium Vegetation |
359
+ | 5 | High Vegetation |
360
+ | 6 | Building |
361
+ | 7 | Low Point (Noise) |
362
+ | 9 | Water |
363
+ | 17 | Bridge Deck |
364
+
296
365
  ### Dynamic COPC Streaming
297
366
 
298
367
  For large COPC (Cloud Optimized Point Cloud) files, dynamic streaming loads only the points visible in the current viewport, dramatically reducing initial load time and memory usage.