3

As part of a geo-indexing script, I'd like to add in support for numerous .laz files we have sitting around on our SAN. The only intent of the handler is to grab the filename/path, the SRS, and the extent of the point cloud file. I do not need to do any processing or analysis on the dots.

So I'm able to do

from laspy.file import File

my_file = File("path/to/file.laz", mode='r')

and it loads the files without error. I can call the File.header property, but have no idea how to "get into" it to extract values or calculate the min/max X/Y.

1 Answer 1

4

You should use min and max property of header.

from laspy.file import File

f = File("path/to/file.laz", mode='r')
h = f.header

# h.min: [min_x, min_y, min_z] - h.max: [max_x, max_y, max_z]
extent = [*h.min, *h.max] # extent: [min_x, min_y, min_z, max_x, max_y, max_z]
6
  • Thanks Kadir; is there a way for me to discern the spatial reference from the header? Or just dump all the header contents as a dict and look through them? I was able to grab the min/max as you showed but it was just line and sample, not coordinate information.
    – auslander
    May 22, 2020 at 20:49
  • I've just looked at laspy docs. It says "srs is not implemented". So, you should probably dump the header contents or use liblas. May 22, 2020 at 21:20
  • Great. How do I dump the header contents? That was part of the question alluded to in my original question on how to get into the header to examine all the values.
    – auslander
    May 23, 2020 at 14:54
  • 1
    Use PDAL to get your SRS info. May 29, 2020 at 1:09
  • 1
    @HowardButler how do I use PDAL to get my SRS info?
    – auslander
    Oct 16, 2020 at 16:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.