I am attempting to open a couple of las files in laspy, however one of them has file version 6.0 (although it does not show up as such in lasinfo - I may be missing something). Digging through the source code, it appears that laspy should handle that by simply using 6.0 on its own, but in prepending an h, the file fails. However, changing this behaviour in the source does not seem to fix it.

With that in mind, is there a way to change (las2las?) the las file so that this is not an issue? Or will I have to ignore this las file?

Here is an image of the error I get:

The issue

  • 1
    What have you tried in las2las? Just straight reading/writing it might do the trick. For liblas's version you could start with las2las -i old.las -o new.las -f <spec version>, or if you're talking lastools it'd be -set_version <spec version>. If it's complaining about point format you could try --point-format <point type> in liblas or -point_type <point type> for lastools – mikewatt Feb 2 '18 at 1:21
  • Is it possible for you to share the file and a snipped of code you're using to attempt to load it? I can try to reproduce your issue. – Alex Leith Feb 4 '18 at 23:11
  • Here's the code snippet: pastebin.com/fP9pz1ab IIRC the file is the sample.las that comes with laspy. @gberard I'll try the lastools command, thanks! – coneypylon Feb 6 '18 at 12:46
  • @gberard, tried the two commands, neither seems to work. I wonder if it may be a problem with laspy itself and this file. – coneypylon Feb 6 '18 at 13:11

According to this page, Laspy supports LAS/LAZ versions 1.0-1.4.

Looking at the Laspy code, it looks like

  • the format string "h6.0" would correspond to a version "1.6" of the spec.

  • A value of "6" for the format corresponds to a specific predefined header format. (See the code, or the following link, for clarification on what that means)

There's a good overview on the LAS format here (from a digital preservation standpoint) https://www.loc.gov/preservation/digital/formats/fdd/fdd000418.shtml. That link also covers what the 1-10 values mean for the headers

I don't see any mention of a version 1.6 on the ASPRS website. There it states that 1.4 is the latest official version. (I'm not sure of the current status of 2.x)

If someone knows of a spec for a version 1.6, then a fair bit of work would be needed in Laspy to support it.

Simply adding "h1.6" to the list of valid formats will stop that error, but will fail further down the line.. there are also version-specific tests when loading files and in the laspy tools themselves.

I think LasTools also supports a similar range of versions, which might explain why it can't read the version from the command line.

Given this is a binary file, it may be a bit tricky to 'fix' it if the tools can't read it. With text files like json or xml it's easy to forgive or ignore missing data; not so with binary.

  • If you created the file in the first place, try using either the "6" or "h4.0" formats instead.

  • If not, try going back to the source of the files to clarify what tools they used to produce it - it may be unreadable for the tools you have available.

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.