IO LAS - martijnkoopman/SpatiumGL GitHub Wiki

This module provides classes and functions for reading and writing ASPRS LAS (.las) and LAZ (.laz) files. It makes use of LASlib to do so. Please refer to the ASPRS LAS file specification for more information about this file format.

Things you should know about ASPRS LAS

  • There are multiple version (1.0 - 1.4). Each version adds new point formats. Backward compatibility is maintained.
  • There are multiple point formats within a single ASPRS LAS version. Each point format defines possible point attributes. For example, the following point formats have RGB color: 2, 3, 5, 7, 8, 10.
  • A file consist of 4 parts:
    • Public Header (Point count, offset, meta data, etc.)
    • Zero or more Variable Length Records (VLRs)
    • Point Record Data (coordinates, colors, classification, etc.)
    • Zero or more Extended Variable Length Records (EVLRs)

Point Data Format fields

The following fields are present in each Point Data Format:

Item Format (0-5) Format (6-10)
X long long
Y long long
Z long long
Intensity unsigned short unsigned short
Return Number 3 bits 4 bits
Number of Returns 3 bits 4 bits
Classification Flags - 2 bits
Scanner Channel - 2 bits
Scan Direction Flag 1 bit 1 bit
Edge of Flight Line 1 bit 1 bit
Classification unsigned char unsigned char
Scan Angle (Rank) signed char short
User Data unsigned char unsigned char
Point Source ID unsigned short unsigned short
GPS Time - double

The following fields are only present in particular Point Data Formats:

Point Data Format GPS Time RGB (color) Wave Packet NIR Since version
0 1.0
1 X 1.0
2 X 1.2
3 X X 1.2
4 X X 1.3
5 X X X 1.3
6 X 1.4
7 X X 1.4
8 X X X 1.4
9 X X 1.4
10 X X X X 1.4

Things you should know about LASlib

  • There is not a lot of documentation available. The best way to learn LASlib is by looking at the examples and debugging them.
  • Files can be read with classes LASReadOpener with LASReader.
  • Files can be written with classes LASWriteOpener and LASWriter
  • Point coordinates are stored as integer values. They are converted to floating points (64 bit) through a scale factor. This scale factor is a floating point (for example 0.001) and defines the precision of the points. Next to that, an offset (64 bit floating point) is also applied. The class responsible for converting between integer and floating point coordinates is LASQuantizer.