python读取las

时间: 2023-07-29 admin 互联网

python读取las

python读取las

最近发现的可以读取las的python包

1. pylas

GitHub上作者在不断完善:
基础教程 of pylas: .html
安装:pip install pylas
使用example:

import pylas
# Directly read and write las
las = pylas.read('filename.las')
las = pylas.convert(las, point_format_id=2)
las.write('converted.las')

# Open data to inspect header and then read
with pylas.open('filename.las') as f:
    if f.header.point_count < 10 ** 8:
        las = f.read()
print(las.vlrs)

2. laspy

GitHub: laspy
基础教程(英文): tutotial of laspy
安装:

pip install laspy

或者

python setup.py build --user
python setup.py install --user

使用example:

from laspy.file import File
import numpy as np

inFile = File('/path/to/file.las', mode='r')

I = inFile.Classification == 2

outFile = File('/path/to/output.las', mode='w', header=inFile.header)
outFile.points = inFile.points[I]
outFile.close()

3. las

GitHub: las

安装:pip install las
使用example:

import las
log = las.LASReader('example1.las')
log.start
log.data

4. pylidar

PyLidar官网

conda config --add channels conda-forge
conda config --add channels rios
conda create -n myenv pylidar
conda activate myenv
conda install pynninterp

另外python-pcl的安装:python-pcl-github