一个用于可视化激光雷达点云的 MapLibre 插件
A MapLibre GL JS plugin for visualizing LiDAR point clouds using deck.gl.
Try the live demo.
Use the Online Viewer to load and visualize any COPC point cloud by entering a URL. You can also use URL parameters for direct linking:
https://opengeos.org/maplibre-gl-lidar/viewer/?url=https://s3.amazonaws.com/hobu-lidar/autzen-classified.copc.lazThis allows you to share links that automatically load specific point clouds.
npm install maplibre-gl-lidar……The @geoql/v-maplibre package provides a VControlLidar component that wraps maplibre-gl-lidar for Vue/Nuxt applications.
npm install @geoql/v-maplibre maplibre-gl-lidar
console.log('Loaded:', info)"
/>
| Prop | Type | Default | Description |
|---|---|---|---|
options |
LidarControlOptions |
See defaults | Configuration options for the LiDAR control |
position |
'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' |
'top-right' |
Position of the control on the map |
defaultUrl |
string |
— | URL of a point cloud file to auto-load on mount |
All LidarControl events are available as Vue events: @load, @loadstart, @loaderror, @unload, @statechange, @stylechange, @collapse, @expand, @streamingstart, @streamingstop, @streamingprogress, @budgetreached.
Access methods via template ref:
Available methods: loadPointCloud, unloadPointCloud, flyToPointCloud, setPointSize, setColorScheme, setOpacity, setPickable, setUsePercentile, setElevationRange, clearElevationRange, setZOffset, setZOffsetEnabled, getShareUrl, restoreFromUrl, toggle, expand, collapse, getState, getPointClouds, stopStreaming, isStreaming.
Vue examples: EPT Streaming · Classification Filter Full docs: @geoql/v-maplibre LidarControl
The main control class implementing MapLibre's IControl interface.
……Share URLs use readable query parameters such as url, lon, lat, zoom, pitch, bearing, color, cmap, size, opacity, and zoff.
The control adapts to light and dark themes. By default (theme: 'auto') it follows the operating system / browser prefers-color-scheme setting. Set theme: 'dark' or theme: 'light' to force a theme, which is handy when pairing the control with a dark basemap, and call setTheme(...) to switch at runtime:
const control = new LidarControl({ theme: 'dark' });
// later
control.setTheme('auto');All colors are driven by --lidar-* CSS custom properties, so you can override individual tokens (or the whole palette) in your own stylesheet. Forced themes add a lidar-theme-dark / lidar-theme-light class to the `` element so panels and modals rendered at the document root inherit the theme too.
The panel can be resized by dragging the grip in its free bottom corner (bottom-left for right-anchored positions, bottom-right for left-anchored positions). It expands to use the available vertical space and shows a vertical scrollbar only when the content overflows.
load - Point cloud loaded successfullyloadstart - Loading startedloaderror - Loading failedunload - Point cloud unloadedstatechange - Control state changedstylechange - Styling changedcollapse - Panel collapsedexpand - Panel expandedstreamingstart - Dynamic streaming startedstreamingstop - Dynamic streaming stoppedstreamingprogress - Streaming progress updatebudgetreached - Point budget limit reached'elevation' - Viridis-like color ramp based on Z values'intensity' - Grayscale based on intensity attribute'classification' - ASPRS standard classification colors'rgb' - Use embedded RGB colors (if available)By default, elevation and intensity coloring uses the 2nd-98th percentile range instead of the full min-max range. This clips outliers and provides better color distribution across the point cloud.
// Percentile coloring is enabled by default
const control = new LidarControl({
colorScheme: "elevation",
usePercentile: true, // default
});
// Disable to use full value range (min-max)
control.setUsePercentile(false);
// Check current setting
console.log(control.getUsePercentile()); // true or falseThe percentile toggle is also available in the GUI panel when using "Elevation" or "Intensity" color schemes. Uncheck "Use percentile range (2-98%)" to use the full value range.
When pickable is enabled, hovering over points displays a tooltip with all available attributes:
Enable via constructor option or toggle in the GUI panel:
// Via constructor
const control = new LidarControl({ pickable: true });
// Or programmatically
control.setPickable(true);
// Optionally filter which fields to display
control.setPickInfoFields([
"Classification",
"Intensity",
"GpsTime",
"ReturnNumber",
]);Shift point clouds vertically for alignment with terrain or other data:
// Via constructor
const control = new LidarControl({
zOffsetEnabled: true,
zOffset: 50, // Shift up 50 meters
});
// Or programmatically
control.setZOffsetEnabled(true);
control.setZOffset(50);
// Get current offset
console.log(control.getZOffset()); // 50The Z offset can also be adjusted interactively via the "Z Offset" checkbox and slider in the GUI panel.
When using the "Classification" color scheme, an interactive legend appears showing all classification types found in the point cloud data. Each classification displays:
Features:
…ASPRS Classification Codes:
| Code | Name |
|---|---|
| 2 | Ground |
| 3 | Low Vegetation |
| 4 | Medium Vegetation |
| 5 | High Vegetation |
| 6 | Building |
| 7 | Low Point (Noise) |
| 9 | Water |
| 17 | Bridge Deck |
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.
Key features:
How it works:
// Dynamic loading is the default for COPC files
const control = new LidarControl();
control.loadPointCloud("https://example.com/large-pointcloud.copc.laz");
// Explicitly set loading mode
const control = new LidarControl({
copcLoadingMode: "dynamic", // or 'full' for complete load
streamingPointBudget: 10_000_000, // 10 million points max
});
// Override per-load
control.loadPointCloud(file, { loadingMode: "full" }); // Force full load
control.loadPointCloud(url, { loadingMode: "dynamic" }); // Force streamingLoading modes:
'dynamic' (default for COPC) - Stream nodes based on viewport, ideal for large files'full' - Load entire point cloud upfront, better for small filesNote: Non-COPC files (regular LAS/LAZ) always use full loading mode since they don't have the octree structure required for streaming.
maplibre-gl-lidar supports Entwine Point Tile (EPT) datasets, a widely-used format for serving large point clouds over HTTP with viewport-based streaming.
Key features:
Loading EPT data:
// Load EPT dataset by URL (automatically detected via ept.json)
lidarControl.loadPointCloud("https://na-c.entwine.io/dublin/ept.json");
// Or load programmatically
lidarControl.loadPointCloudEptStreaming(
"https://na-c.entwine.io/dublin/ept.json",
{
pointBudget: 5_000_000, // Max points in memory
}
);Sample EPT datasets:
https://na-c.entwine.io/dublin/ept.jsonhttps://na-c.entwine.io/nyc/ept.jsonhttps://na-c.entwine.io/red-rocks/ept.jsonNote: EPT datasets require CORS support from the server. The sample datasets from entwine.io are CORS-enabled.
const {
state,
setState,
setPointSize,
setOpacity,
setColorScheme,
setUsePercentile,
setElevationRange,
setZOffsetEnabled,
setZOffset,
toggle,
reset,
} = useLidarState(initialState?);c暂无开放 Issues,或尚未同步最近议题。