Learn R Programming

lidR (version 3.1.1)

LAS-class: An S4 class to represent a .las or .laz file

Description

Class LAS is the representation of a las/laz file according to the LAS file format specifications.

Usage

LAS(data, header = list(), proj4string = sp::CRS(), check = TRUE, index = NULL)

Arguments

data

a data.table containing the data of a las or laz file.

header

a list or a LASheader containing the header of a las or laz file.

proj4string

projection string of class CRS-class.

check

logical. Conformity tests while building the object.

index

list with two elements list(sensor = 0L, index = 0L). See spatial indexing

Value

An object of class LAS

Functions

  • LAS: creates objects of class LAS. The original data is updated by reference to quantize the coordinates according to the scale factor of the header if no header is provided. In this case the scale factor is set to 0.001

Slots

bbox

Object of class matrix, with bounding box

proj4string

Object of class CRS, projection string

data

Object of class data.table. Point cloud data according to the LAS file format

header

Object of class LASheader. las file header according to the LAS file format

index

list. See spatial indexing.

Extends

Class Spatial, directly.

Details

A LAS object inherits a Spatial object from sp. Thus it is a Spatial object plus a data.table with the data read from a las/laz file and a LASheader (see the ASPRS documentation for the LAS file format for more information). Because las files are standardized the table of attributes read from the las/laz file is also standardized. Columns are named:

  • X (numeric)

  • Y (numeric)

  • Z (numeric)

  • gpstime (numeric)

  • Intensity (integer)

  • ReturnNumber (integer)

  • NumberOfReturns (integer)

  • ScanDirectionFlag (integer)

  • EdgeOfFlightline (integer)

  • Classification (integer)

  • Synthetic_flag (logical)

  • Keypoint_flag (logical)

  • Withheld_flag (logical)

  • ScanAngleRank (integer)

  • ScanAngle (numeric)

  • UserData (integer)

  • PointSourceID (integer)

  • R,G,B (integer)

  • NIR (integer)

See Also

readLAS

Examples

Run this code
# NOT RUN {
# Read a las/laz file
LASfile <- system.file("extdata", "example.laz", package="rlas")
las <- readLAS(LASfile)
las

# Creation of a LAS object out of external data
data <- data.frame(X = runif(100, 0, 100),
                   Y = runif(100, 0, 100),
                   Z = runif(100, 0, 20))

# 'data' has many decimal digits
data

# Create a default header and quantize *by reference*
# the coordinates to fit with offset and scale factors
cloud <- LAS(data)

# 'data' has been updated and coordinates were quantized
data
cloud

# Be careful when providing a header the function assumes that
# it corresponds to the data and won't quantize the coordinates
data <- data.frame(X = runif(100, 0, 100),
                   Y = runif(100, 0, 100),
                   Z = runif(100, 0, 20))
header <- las@header

# This works but triggers warnings and creates an invalid LAS object
cloud <- LAS(data, header)

las_check(cloud)
# }

Run the code above in your browser using DataLab