## License Information

Use of this function requires a license for Whitebox Workflows for Python Professional (WbW-Pro). Please visit www.whiteboxgeo.com to purchase a license.

## Description

This tool can be used to sort the points in an input LiDAR file (`input`) based on their properties with respect to one or more sorting criteria (`criteria`). The sorting criteria may include: the x, y or z coordinates (`x`, `y`, `z`), the intensity data (`intensity`), the point class value (`class`), the point user data field (`user_data`), the return number (`ret_num`), the point source ID (`point_source_id`), the point scan angle data (`scan_angle`), the scanner channel (`scanner_channel`; LAS 1.4 datasets only), and the acquisition time (`time`). The following is an example of a complex sorting criteria statement that includes multiple criteria:

`x 100.0, y 100.0, z 10.0, scan_angle`

Criteria should be separated by a comma, semicolon, or pipe (|). Each criteria may have an associated bin value. In the example above, point `x` values are sorted into bins of 100 m, which are then sorted by `y` values into bins of 100 m, and sorted by point `z` values into bins of 10 m, and finally sorted by their `scan_angle`.

Sorting point values can have a significant impact on the compression rate when using certain compressed LiDAR data formats (e.g. LAZ, zLidar). Sorting values can also improve the visualization speed in some rendering software.

Note that if the user does not specify the optional input LiDAR file, the tool will search for all valid LiDAR (.las, .laz, *.zlidar) files contained within the current working directory. This feature can be useful for processing a large number of LiDAR files in batch mode. When this batch mode is applied, the output file names will be the same as the input file names but with a '_sorted' suffix added to the end.

## Function Signature

`def sort_lidar(self, sort_criteria: str, input_lidar: Optional[Lidar]) -> Optional[Lidar]: ...`

## Project Links

WbW Homepage User Manual Support WbW