# Lidar preprocessing
```{container} algorithm-id
**Algorithm ID**: `hedgetools:lidarpreprocessing`
```
Preprocess lidar point cloud COPC files. COPC files are point clouds files optimized for spatial request and can be created from common LAS/LAZ files using QGIS [pdal:createcopc](https://docs.qgis.org/3.44/fr/docs/user_manual/processing_algs/qgis/pointclouddatamanagement.html#create-copc) algorithm. Preprocessing operations available are display below panels for parameters and outputs and are calls to [PDAL](https://pdal.org/en/2.10.0/) library algorithms.
Preprocessed point clouds files are saved in a destination folder.
## Parameters
| Label | Name | Type | Description |
| -------------------------------------------- | -------------- | ------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------- |
| COPC lidar files | `LIDAR_FOLDER` | [folder] | Folder with COPC lidar files. |
| Lidar preprocessing operations
Optional | `OPERATIONS` | [string]
Default: None | JSON string containing preprocessing operations with parameters. Choice of operations is made using `Lidar preprocessing operations` panel. |
| Mask
Optional | `MASK` | [vector: polygon] | Polygon layer to clip lidar point cloud. |
| Parrallel threads | `WORKERS` | [numeric: integer] | Number of parrallel threads. |
| Destination folder | `OUTPUT` | [string]
Default: `[Save in temporary folder]` | Folder to save preprocessed point cloud COPC files. |
## Operations
### Height Above Ground normalization
Normalize height with nearest neighbor or delaunay filer.
PDAL documentation:
- https://pdal.io/en/2.8.4/stages/filters.hag_delaunay.html
- https://pdal.io/en/2.8.4/stages/filters.hag_nn.html
| Name | Type | Description |
| ---------- | --------------------------- | -------------------------------------------- |
| `Strategy` | [string]
Default: `nn` | Normalization strategy (`delaunay` or `nn`). |
### Assignment
Assign values for a dimension range to a specified value.
PDAL documentation:
- https://pdal.io/en/2.8.4/stages/filters.assign.html
| Name | Type | Description |
| ------------ | -------- | ------------------------------------------------------------ |
| `Condition` | [string] | Condition to assign value. Must be writted with PDAl syntax. |
| `Assignment` | [string] | Assignation. Must be writted with PDAL syntax. |
### Range filter
Filters dimension within a given range.
PDAL documentation:
- https://pdal.io/en/2.8.4/stages/filters.range.html
| Name | Type | Description |
| ---------------- | --------------------------------------- | ------------------------------------------------------------------------- |
| `Field` | [string]
Default: `Classification` | Point cloud dimension/field to filter (`Classification`, `X`,`Y` or `Z`). |
| `Inferior bound` | [numeric: integer]
Default : 1 | Inferior bound for range filter. Keep values above. |
| `Superior bound` | [numeric: integer]
Default : 99 | Superior bound for range filter. Keep values below. |
### Statistical Outliers Removal
Remove point cloud outliers.
PDAL documentation:
- https://pdal.io/en/2.8.4/stages/filters.outlier.html
| Name | Type | Description |
| ------------------------------ | ----------------------------------------------- | ------------------------------------------------------- |
| `Mean number of neighbors` | [numeric: integer]
Default: 8 | Mean number of neighbors (statistical method only). |
| `Standard deviation threshold` | [numeric: double]
Default : 2.0 | Standard deviation threshold (statistical method only). |
| `Method` | [string]
Default : `statistical` | The outlier removal method (`statistical` or `radius`). |
| `Radius` | [numeric: double]
Default : 1.0 | Radius (radius method only). |