pylas: Python library for lidar LAS/LAZ IO.¶
LAS (and it’s compressed counterpart LAZ), is a popular format for lidar pointcloud and full waveform, pylas reads and writes these formats and provides a Python API via Numpy Arrays.
Here is an example of reading in LAZ data and getting some simple summaries of the pointcloud:
import numpy as np
import pylas
with pylas.open('pylastests/simple.laz') as fh:
print('Points from Header:', fh.header.point_count)
las = fh.read()
print(las)
print('Points from data:', len(las.points))
ground_pts = las.classification == 2
bins, counts = np.unique(las.return_number[ground_pts], return_counts=True)
print('Ground Point Return Number distribution:')
for r,c in zip(bins,counts):
print(' {}:{}'.format(r,c))
Would output:
Points from Header: 1065
<LasData(1.2, point fmt: <PointFormat(3)>, 1065 points, 0 vlrs)>
Points from data: 1065
Ground Point Return Number distribution:
1:239
2:25
3:11
4:1