Learn R Programming

lidR (version 2.0.0)

readLAS: Read .las or .laz files

Description

Reads .las or .laz files in format 1 to 3 according to LAS specifications and returns an object of class LAS. If several files are read at once the returned LAS object is considered as one LAS file. The optional parameters enable the user to save a substantial amount of memory by choosing to load only the attributes or points of interest. The LAS format 1.4 is currently only partially supported.

Usage

readLAS(files, select = "*", filter = "")

Arguments

files

characters. Path(s) to one or several a file(s). Can also be a LAScatalog object.

select

character. Read only attributes of interest to save memory (see details).

filter

character. Read only points of interest to save memory (see details).

Value

A LAS object

Details

Select: the 'select' argument specifies which attribute will actually be loaded. For example, 'xyzia' means that the x, y, and z coordinates, the intensity and the scan angle will be loaded. The supported entries are t - gpstime, a - scan angle, i - intensity, n - number of returns, r - return number, c - classification, u - user data, p - point source ID, e - edge of flight line flag, d - direction of scan flag, R - red channel of RGB color, G - green channel of RGB color, B - blue channel of RGB color, N - near infrared channel. Also numbers from 1 to 9 are available for the extra bytes data 1 to 9. 0 enables loading of all extra bytes and '*' is the wildcard and enables everything to be loaded from the LAS file. Note that x, y, z are implicit and always loaded, thus 'xyzia' is equivalent to 'ia'. Filter: the 'filter' argument allows filtering of the point cloud while reading files. This is much more efficient than lasfilter in many ways. If the desired filters are known before reading the file, the internal filters should always be preferred. The available filters are those from LASlib and can be found by running the following command: rlas:::lasfilterusage(). (see also rlas::read.las)

Examples

Run this code
# NOT RUN {
LASfile <- system.file("extdata", "Megaplot.laz", package="lidR")
las = readLAS(LASfile)
las = readLAS(LASfile, select = "xyz")
las = readLAS(LASfile, select = "xyzi", filter = "-keep_first")
las = readLAS(LASfile, select = "xyziar", filter = "-keep_first -drop_z_below 0")

# Negation of attribute is also possible (all except intensity and angle)
las = readLAS(LASfile, select = "* -i -a")
# }

Run the code above in your browser using DataLab