从 numpy 读取并另存为 las 文件

问题描述

我想以 .las 格式保存一些文件,我找到了这个代码

import laspy
import numpy as np

hdr = laspy.header.Header()

outfile = laspy.file.File("output.las",mode="w",header=hdr)
allx = np.array([1.000,2.000,3.000,3.000]) # Four Points
ally = np.array([0.000,0.000,3.000])
allz = np.array([10.000,10.000,11.000,11.000])

xmin = np.floor(np.min(allx))
ymin = np.floor(np.min(ally))
zmin = np.floor(np.min(allz))

outfile.header.offset = [xmin,ymin,zmin]
outfile.header.scale = [0.001,0.001,0.001]

outfile.x = allx
outfile.y = ally
outfile.z = allz

outfile.close()  

这可以正常工作但是这是针对只有 XYZ 值的数据,我如何为具有 XYZ 标签 值的数据编写这个? ??...我的源数据集是 *.txt 格式。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)