[Liblas-devel] LAS I/O and header question?
Jason Woolard
Jason.Woolard at noaa.gov
Fri Oct 10 16:12:56 EDT 2008
hi everyone,
I just got the library running in Python and I have a quick question for
anyone out there. I've had success with the tutorial but a little
trouble implementing some things. Just for starters I was trying to read
through a LAS file, extract some points by elevation, update the header
and write a new file out. I can extract the points I want or update the
header I just can make them work together. I just joined the group a few
days ago so I apologize if I'm missing something obvious here.
Here is the version of the script that will return the points but not
update the header. I can modify this slightly based on the tutorial to
return a modified header but the data points seem to be in a different
coord system or have a funky scale factor applied.
Thanks in advance for any insight.
import os
from liblas import file
from liblas import point
from liblas import header
infile = file.File('C:\\liblas_test\\debug.las',mode='r')
outfile = file.File('C:\\liblas_test\\outlas.las',mode='w',header =
infile.header)
#Update records in LAS file
outfile.header.set_dataformatid(1)
outfile.header.set_majorversion(1)
outfile.header.set_minorversion(0)
outfile.header.set_softwareid('Test')
for p in infile:
#Locate and write points less than or equal to -24 meters in elev
if p.z <= -24.00:
pt = liblas.point.Point()
pt.x = p.x
pt.y = p.y
pt.z = p.z
outfile.write(pt)
infile.close()
outfile.close()
More information about the Liblas-devel
mailing list