@sitn/gg-lidar-viewer
v0.4.2
Published
GeoGirafe plugin to browse LiDAR tile indexes (GeoJSON or STAC) and view COPC point clouds in 3D with Giro3D
Maintainers
Readme
@sitn/gg-lidar-viewer
A GeoGirafe panel to browse LiDAR tile indexes (a GeoJSON file or a STAC catalog) on the 2D map and view the selected COPC point clouds in a 3D split view powered by Giro3D.
Installation steps
Create your project based on GeoGirafe. To create a new GeoGirafe project, follow the instruction on https://gitlab.com/geogirafe/gg-viewer
Install this plugin using
npm i @sitn/gg-lidar-viewerIn
index.htmladd<lidar-viewer slot="main"></lidar-viewer>in the tag<girafe-lr-panel class="panel-right" dock="right">Add a button to open the panel, with the following code in the
buttonbar-grid
<button
tip="lidar-viewer-panel"
slot="menu-content"
class="gg-icon-button gg-big"
onclick="
document.geogirafe.state.interface.lidarViewerVisible =
!document.geogirafe.state.interface.lidarViewerVisible
">
<svg viewBox="0 0 24 24" width="22" height="22" fill="currentColor" aria-hidden="true">
<circle cx="3" cy="9" r="1.8"/>
<circle cx="8" cy="4" r="1.8"/>
<circle cx="14" cy="2" r="1.8"/>
<circle cx="20" cy="5" r="1.8"/>
<circle cx="21" cy="12" r="1.8"/>
<circle cx="5" cy="15" r="1.8"/>
<circle cx="12" cy="13" r="1.8"/>
<circle cx="18" cy="18" r="1.8"/>
<circle cx="9" cy="20" r="1.8"/>
<circle cx="2" cy="21" r="1.8"/>
</svg>
</button>- In
main.ts, import and register the plugin :
- Add
import LidarViewerComponent from '@sitn/gg-lidar-viewer'in the list of imports - Add
iface['lidarViewerVisible'] = false;to the block that seeds custom panel toggle paths in the state before defining the elements - Add
customElements.define('lidar-viewer', LidarViewerComponent);in thegirafeApp.isReady()promise
STAC catalogs
With STAC API as source, Load tiles loads the tile footprints of the catalog when it has some: the GeoJSON assets
with role index of its collections (/collections), one Feature per item with its file URL (file_url) and item URL
(item_url), as published by stac-lidar-aggregator, one per source collection. All of them are loaded at once:
- footprints of collections whose
item_assetsdeclare a point cloud (or noitem_assets) are the COPC tiles of the map; - footprints of collections whose
item_assetsdeclare a GeoTIFF list raster models (COG), which Raster models adds to the 2D map, under the tiles (raw elevations,lidar:render=raw, stretched from 200 to 2500 m).
A catalog without footprints is searched instead (/search), in the visible area only: move the map and load again
for other areas.
The Collections list holds the collections that directly contain the tiles, grouped by the collection holding their
footprints (e.g. a provider): one per footprint file, or the last of the items'
properties.collection hierarchy (else their collection) for searches. They are unchecked at first: check one, or
all for a group, to show its tiles on the map. Year keeps the tiles of one acquisition year (datetime).
Panel
- Source (collapsed at first) chooses the tile index: a GeoJSON URL or a STAC catalog.
- Click a tile on the map to select it and show it in 3D, shift-click to add or remove one; check tiles in the list to
show them in 3D. Each tile has links to its STAC page (in STAC Browser when
browserUrlis set), its file and a copy of its URL. A warning appears abovemaxVisibleTilestiles shown at once. - Copy link copies a link opening the tiles shown in 3D from the same point of view; the page's URL follows them
(
?stac_items=<item URL>,<item URL>&lidar_camera=<x,y,z of the camera and of its target>). A link withstac_itemsalone opens these STAC items in 3D, e.g. from stac-lidar-aggregator's "Voir en 3D" links. - Classes shown drops the points of the unchecked ASPRS classes (ground, vegetation, buildings…) when loading them.
- Measures: coordinates of a point, distance, height, and a cross-section profile of the loaded points within 1 m of a line.
- View: fit the camera, follow the 2D map, and an orthophoto (SWISSIMAGE) laid flat under the points. The 3D view has a north arrow and its width can be dragged.
- The panel is in French, German, Italian and English, following GeoGirafe's language.
Configuration
Optional, in the extendedConfig section of your project's config.json:
"extendedConfig": {
"lidarViewer": {
"stacUrl": "https://example.com/stac/",
"browserUrl": "https://example.com/browser/",
"lazPerfPath": "laz-perf",
"maxVisibleTiles": 10,
"orthophoto": { "capabilities": "https://wmts.geo.admin.ch/EPSG/2056/1.0.0/WMTSCapabilities.xml", "layer": "ch.swisstopo.swissimage" }
}
}stacUrl: default STAC catalog: the panel opens on STAC API and loads it the first time it opens.browserUrl: the STAC Browser of that catalog, for the tiles' STAC pages (item URLs starting withstacUrl).lazPerfPath: directory servinglaz-perf.wasm(copynode_modules/laz-perf/lib/laz-perf.wasminto yourpublic/), relative to the page; by default it is loaded from a CDN.maxVisibleTiles(default 10) andorthophoto(WMTS capabilities and layer, default SWISSIMAGE).
The 3D view is in Swiss LV95 (EPSG:2056), the coordinate system of the COPC files it is made for.
