Main Content

writePointCloud

Write point cloud data to LAS or LAZ file

Since R2022a

Description

writePointCloud(lasWriter,ptCloud) writes point cloud data from a non-empty, unorganized pointCloud object, ptCloud, to a LAS or LAZ file using the lasFileWriter object lasWriter.

example

writePointCloud(lasWriter,ptCloud,ptAttributes) additionally writes the point attributes specified by ptAttributes to the LAS or LAZ file.

Examples

collapse all

Create a lasFileReader object to access LAZ file data.

fileName = fullfile(toolboxdir("lidar"),"lidardata", ...
    "las","aerialLidarData2.las");
lasReader = lasFileReader(fileName);

Read the point cloud data and point attributes from the LAZ file using the readPointCloud function.

[ptCloud,pointAttributes] = readPointCloud(lasReader, ...
    Classification=3:6, ...
    Attributes=["GPSTimeStamp","ScanAngle"]);

Create a lasFileWriter object to store the point cloud data in a LAS file.

lasWriter = lasFileWriter("points",PointDataFormat=1);

Write points related to vegetation and building in LAZ file.

writePointCloud(lasWriter,ptCloud,pointAttributes);

Input Arguments

collapse all

LAS or LAZ file writer, specified as a lasFileWriter object.

Point cloud, specified as an unorganized pointCloud object.

Use the removeInvalidPoints function to remove invalid points from the point cloud and to convert an organized point cloud to an unorganized point cloud.

Point attributes, specified as a lidarPointAttributes object. Unspecified fields of the lidarPointAttributes object are set to their default values. The default values for the LaserReturn and NumReturns fields are 1, while all other point properties defined by the ptCloud and PtAttributes objects default to 0.

Version History

Introduced in R2022a