Converting LAS/LAZ files to textfiles with generated headers

One of the first LAStools features was to export LAS/LAZ to textfiles and import textfiles to LAS/LAZ (las2txt and txt2las). Typically, the format for parsing the textfile is specified in the “-parse” or “-oparse” argument. The parameters of this argument define which properties of a lidar point are exported or imported. With Version 240125, these tools have a new feature to create & read a header line that defines the column entries of an export or import.

Exporting textfiles with a descriptive header line

To export an additional header line, you can simply add the “-coldesc“ argument.

las2txt64 -i lake.laz -parse xyzcnr -coldesc

Exports the input file to a textfile. The textfile contains a column description in its first line.

x y z classification number_of_returns return_number
477023.42 4366690.96 2737.19 1 1 1
477025.41 4366690.63 2736.54 1 1 1
477027.19 4366690.33 2736.32 1 1 1
477028.82 4366690.03 2736.35 1 1 1
477030.50 4366689.74 2736.32 1 1 1
477032.21 4366689.43 2736.26 1 1 1
477033.89 4366689.14 2736.20 1 1 1
477035.56 4366688.84 2736.17 1 1 1

Exporting the column description results in two major improvements:

  • It is easy to see what content is contained in the textfile.
  • It is not necessary to define a “-parse“ argument when re-importing this textfile into a LAZ file.

Generating LAZ files from textfiles

When importing from a textfile, txt2las automatically detects a column description header. If a header contains column information, this data is used to generate a temporary parse string for this import.

txt2las64 -i lake.txt -o imp.laz

It is enough to import a previously exported textfile containing column information. Verbosity provides information about the parsing string created from the column description.

Column description detected. Parse string is xyzcnr
opening reader took 0.008 sec.
reading from 'lake.txt' and writing to 'imp.laz'
main pass took 0.078 sec.
done with 'imp.laz'. total time 0.078 sec.

It is also possible to generate textfiles with header information generated by thirt-party software. The permitted header tokens are listed in the txt2las readme file.

Nach oben scrollen