rlas (version 1.1.0)

readlasdata: Read data from a .las or .laz file

Description

Reads data from .las or .laz files in format 1 to 4 according to LAS specifications and returns a data.table labeled according to LAS specifications. See the ASPRS documentation for the LAS file format. The optional logical parameters enables the user to save memory by choosing to load only the fields they need. Indeed, data is loaded into the computer's memory (RAM) suboptimally because R does not accommodate many different data types. Moreover, the function provides a streaming filter to load only the points of interest into the memory without allocating any superfluous memory.

Usage

readlasdata(file, Intensity = TRUE, ReturnNumber = TRUE, NumberOfReturns = TRUE, ScanDirectionFlag = TRUE, EdgeOfFlightline = TRUE, Classification = TRUE, ScanAngle = TRUE, UserData = TRUE, PointSourceID = TRUE, RGB = TRUE, filter = "")

Arguments

file
filepath character string to the .las or .laz file
Intensity
logical. do you want to load the Intensity field? default: TRUE
ReturnNumber
logical. do you want to load the ReturnNumber field? default: TRUE
NumberOfReturns
logical. do you want to load the NumberOfReturns field? default: TRUE
ScanDirectionFlag
logical. do you want to load the ScanDirectionFlag field? default: TRUE
EdgeOfFlightline
logical. do you want to load the EdgeOfFlightline field? default: TRUE
Classification
logical. do you want to load the Classification field? default: TRUE
ScanAngle
logical. do you want to load the ScanAngle field? default: TRUE
UserData
logical. do you want to load the UserData field? default: TRUE
PointSourceID
logical. do you want to load the PointSourceID field? default: TRUE
RGB
logical. do you want to load R,G and B fields? default: TRUE
filter
character. filter data while reading the file (streaming filter) without allocating any useless memory. (see Details).

Value

A data.table

Details

Because rlas relies on the well-known LASlib library written by Martin Isenburg to read the binary files, the package also inherits the filter commands available in LAStools. To use these filters the user can pass the common commands from LAStools into the parameter 'filter'. Type rlas:::lasfilterusage() to display the LASlib documentation and the available filters. The filter works in two passes. First it streams the file without loading anything and counts the number of points of interest. Then it allocates the necessary amount of memory and reads the file a second time, and stores the points of interest in the computer's memory (RAM).

See Also

Other rlas: readlasheader, writelas

Examples

Run this code
lazfile <- system.file("extdata", "example.laz", package="rlas")

lasdata <- readlasdata(lazfile)
lasdata <- readlasdata(lazfile, filter = "-keep_first")
lasdata <- readlasdata(lazfile, filter = "-drop_intensity_below 80")

Run the code above in your browser using DataLab