本地Python ASPRS LAS读写库
项目描述
Laspy
Laspy是一个用于读取、修改和创建LAS LiDAR文件的Python库。
Laspy与Python 3.8+兼容。
功能
- LAS支持。
- 通过*lazrs*或*lazzip*后端支持*LAZ*。
- LAS/LAZ的流式/分块读取/写入。
- 通过文件支持COPC。
- 使用*requests*包通过https支持COPC。
- 通过*pyproj*包支持CRS。
示例
直接读取和写入las
import laspy
las = laspy.read('filename.las')
las.points = las.points[las.classification == 2]
las.write('ground.laz')
打开数据以检查头信息(仅打开读取头信息和vlrs)
import laspy
with laspy.open('filename.las') as f:
print(f"Point format: {f.header.point_format}")
print(f"Number of points: {f.header.point_count}")
print(f"Number of vlrs: {len(f.header.vlrs)}")
使用'分块'读取和写入功能
import laspy
with laspy.open('big.laz') as input_las:
with laspy.open('ground.laz', mode="w", header=input_las.header) as ground_las:
for points in input_las.chunk_iterator(2_000_000):
ground_las.write_points(points[points.classification == 2])
将点追加到现有文件
import laspy
with laspy.open('big.laz') as input_las:
with laspy.open('ground.laz', mode="a") as ground_las:
for points in input_las.chunk_iterator(2_000_000):
ground_las.append_points(points[points.classification == 2])
API文档和教程可在ReadTheDocs找到。
安装
Laspy可以通过*pip*安装
pip install laspy # without LAZ support
# Or
pip install laspy[laszip] # with LAZ support via LASzip
# Or
pip install laspy[lazrs] # with LAZ support via lazrs
变更日志
项目详情
下载文件
下载适合您平台文件的文件。如果您不确定选择哪个,请了解有关安装包的更多信息。
源分布
laspy-2.5.4.tar.gz (1.6 MB 查看散列)
构建分布
laspy-2.5.4-py3-none-any.whl (84.3 kB 查看散列)