readTLS: Import a point cloud file into a LAS object

Description Usage Arguments Value Examples

View source: R/methods.R


Wrapper to read point cloud files straight into LAS objects. Reads las or laz files with readLAS, ply files with read.las and other file formats with fread (txt, xyz, 3d or any other table like format).


readTLS(file, col_names = NULL, ...)



file path.


optional - character vector. Only used for table-like objects. It states the column names. If not set, only the 3 first columns will be used and assigned to the XYZ fields.


further arguments passed down to readLAS, read.las or fread.


LAS object.


cloud = matrix(runif(300), ncol=3)
file = tempfile(fileext = '.txt')
fwrite(cloud, file)
tls = readTLS(file)

Example output

Loading required package: data.table
Loading required package: magrittr
Loading required package: lidR
Loading required package: raster
Loading required package: sp

Attaching package:rasterThe following object is masked frompackage:magrittr:


The following object is masked frompackage:data.table:


Warning messages:
1: In rgl.init(initValue, onlyNULL) : RGL: unable to open X11 display
2: 'rgl.init' failed, running with 'rgl.useNULL = TRUE'. 
x being coerced from class: matrix to data.table
class        : LAS (v1.2 format 0)
memory       : 12.3 Kb 
extent       : 0, 0.997, 0.001, 0.997 (xmin, xmax, ymin, ymax)
coord. ref.  : NA 
area         : 0.931789 units²
points       : 100  points
density      : 107.32 points/units²
File signature:           LASF 
File source ID:           0 
Global encoding:
 - GPS Time Type: Standard GPS Time 
 - Synthetic Return Numbers: no 
 - Well Know Text: CRS is GeoTIFF 
 - Aggregate Model: false 
Project ID - GUID:        00000000-0000-0000-0000-000000000000 
Version:                  1.2
System identifier:        rlas R package 
Generating software:      rlas R package 
File creation d/y:        34/2021
header size:              227 
Offset to point data:     227 
Num. var. length record:  
Point data format:        0 
Point data record length: 20 
Num. of point records:    100 
Num. of points by return: 0 0 0 0 0 
Scale factor X Y Z:       1e-04 1e-04 1e-04 
Offset X Y Z:             0 0 0 
min X Y Z:                0 0.001 0.004 
max X Y Z:                0.997 0.997 0.999 
Variable length records:  void

TreeLS documentation built on Aug. 26, 2020, 5:14 p.m.