Python でliblasを使用して、特別なポイント形式を読み取り、操作し、書き込みます*.las
。私は文字列を持っています
s = "309437.95 6959999.84 118.98 16 1 1 0 0 1 0 112.992 5.9881"
最初の要素はX
、2 番目のY
要素は 、3 番目の要素はZ
などです。
Liblas を使用して、空のliblas.point.Point
オブジェクトを作成します
>>> pt = liblas.point.Point()
>>> pt
<liblas.point.Point object at 0x0000000005194470>
その後、空であるため、このオブジェクトを埋める必要があります。
>>> pt.x, pt.y,pt.z
(0.0, 0.0, 0.0)
おそらく使っている
>>> pt.get_x
<bound method Point.get_x of <liblas.point.Point object at 0x0000000005194470>>
私はすべての助けと提案に感謝したいと思います.私は本当にこのステップを解決する必要があります.
Martijn Pieters の提案から
s = "%s %s %s" % (s, value, nh)
>>> s
'309437.95 6959999.84 118.98 16 1 1 0 0 1 0 112.992 5.9881'
# create a liblas.point.Point
pt = liblas.point.Point()
pt.x = float(s.split()[0])
pt.y = float(s.split()[1])
pt.z = = float(s.split()[11]) # the new Z value
pt.intensity = = int(s.split()[3])
pt.return_number= int(s.split()[4])
pt.number_of_returns = int(s.split()[5])
pt.scan_direction = int(s.split()[6])
pt.flightline_edge = int(s.split()[7])
pt.classification = int(s.split()[8])
pt.scan_angle = int(s.split()[9])