2

I have a .las point cloud data file that I am trying to get the vlr data from. I have found this link - Update EVLR header info for .LAS file using laspy and have read the docs on Laspy - https://pythonhosted.org/laspy/header.html

It seems like the header vlrs should return a variable length record if it exists.

las_file =laspy.file.File(file.las, mode = "r-")
hdr = las_file.header
hformat = hdr.header_format
for spec in hformat:
    print(spec.name, spec.offs, spec.num)
    
inVLRs = hdr.vlrs
print(inVLRs)
vlr_count = len(inVLRs)
# OGC Coordinate System WKT
print(hdr.max, hdr.version, vlr_count)

I never get anything back for the vlrs. I get all other header info without an issue. Sample file here.

When I use WhiteBoxTools - I do get the correct VLR info. - https://pypi.org/project/whitebox/

Am I using the correct method to get vlrs?

0

The "r-" in the line las_file =laspy.file.File(file.las, mode = "r-") is the problem. I changed it to "r" and the problem is solved.

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.