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

readlasdata {rlas} | R Documentation

## 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(files, i = TRUE, r = TRUE, n = TRUE, d = TRUE, e = TRUE,
      c = TRUE, a = TRUE, u = TRUE, p = TRUE, rgb = TRUE, t = TRUE,
      filter = "", eb = 0)

### Arguments

`files` | filepath character string to the .las or .laz files
`i` | logical. do you want to load the Intensity field? default: TRUE
`r` | logical. do you want to load the ReturnNumber field? default: TRUE
`n` | logical. do you want to load the NumberOfReturns field? default: TRUE
`d` | logical. do you want to load the ScanDirectionFlag field? default: TRUE
`e` | logical. do you want to load the EdgeOfFlightline field? default: TRUE
`c` | logical. do you want to load the Classification field? default: TRUE
`a` | logical. do you want to load the ScanAngle field? default: TRUE
`u` | logical. do you want to load the UserData field? default: TRUE
`p` | 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
`t` | logical. do you want to load gpstime fields? default: TRUE
`filter` | character. filter data while reading the file (streaming filter) without allocating any useless memory. (see Details).
`eb` | integer vector. which extra byte attributes to load (see LAS file format specs). default is 0 meaning that all extra fields will be loaded. `c(1,3,7)` to load the first, the third and the seventh extra byte attributes. None is `numeric(0)` or `NULL`.

### 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.

### Value

A `data.table`

### See Also

Other rlas: `readlasheader`, `writelas`

### Examples

    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")

[Package rlas version 1.1.9 Index]