Overview of the LASer format
The LASer format is an exchange format for three-dimensional point clouds. It uses the .las
extension.
LASer LiDAR files also come in a compressed variant, called LASzip. In that case, they have the .laz
extension.
The specifications are maintained by the ASPRS foundation. See http://www.asprs.org/Committee-General/LASer-LAS-File-Format-Exchange-Activities.html for more information about the specifications.
The LASer format is a binary format roughly consisting of three parts:
-
A header, describing the number of points, the size of the point records and so on.
-
Various variable-length records. These records can contain the spatial reference, but can also contain vendor-specific data.
-
The point data, as a linear list of records. Each point has a location and various attributes.
Decoding LASer data
Using the TLcdLASModelDecoder
You can decode .las
and .laz
files using TLcdLASModelDecoder
, as shown in Program: Using TLcdLASModelDecoder
to decode a point cloud from a .las
file.
TLcdLASModelDecoder
to decode a point cloud from a .las
file
TLcdLASModelDecoder lasDecoder = new TLcdLASModelDecoder();
ILcdModel lasModel = lasDecoder.decode("file.las");
LAS model structure
The decoder produces a model that contains unspecified elements, and that can only be used for visualization.
The points themselves are lazily loaded when this object is accessed by a painter. As such, the bulk of the work is not done
in the decode()
method, but at a later stage.
The TLcdLASModelDescriptor
contains most of the .las
header information, as well as
all the variable-length records from the file.
The TLcdLASModelDescriptor
also has a data type. You can use its properties to style the LIDAR data with ILcdExpression
instances in TLspPlotStyle
.
For more information about LIDAR data styling with ILcdExpression
, see
How to customize the styling of a LIDAR point cloud.
Decoding the model reference
A .las
file can contain spatial reference information in a variable-length record.
If that is the case, the model decoder will use it to set its spatial reference.
If the file does not contain a spatial reference, the model decoder will use its model reference decoder to determine the
spatial reference.
Consult the class javadoc of TLcdLASModelDecoder
for more information.
Filtering the loaded points
LIDAR scans typically contain a large amount of points. LuciadLightspeed allows you to reduce the amount of information decoded from the file.
Using a decoding filter
If you know up front of points that you do not want to visualize, you can filter them out while decoding. To filter points
out, use an ILcdFilter
that you can set on the model decoder through setPointFilter()
.
The filter will be called with an ILcdDataObject
, so you can use its properties for filtering.
Reducing the number of loaded points
If you want to load a file that is just too big, but you still want to see something, you can use setMaximumNumberOfPoints()
to set a maximum number of points to decode.
The decoder will decode at most this number of points, taken randomly from the whole file. As such, you see a lower-resolution
version of the data.