Learn R Programming

⚠️There's a newer version (1.8.0) of this package.Take me there.

R package to read and write .las and .laz binary files used to store LiDAR data.

rlas relies on a modified version of the open source parts of LAStools. LASlib and LASzip were modified to be compatible with R. The library can therefore be compiled into R without any complaints from R CMD check. It enables users to read and write into R binary files commonly used to store LiDAR data in R both at the R level and at the C++ level.

Install rlas

  • The latest released version from CRAN with
install.packages("rlas")
  • The latest development version from github with
devtools::install_github("Jean-Romain/rlas", dependencies=TRUE)

To install the package from github make sure you have a working development environment.

  • Windows: Install Rtools.exe.
  • Mac: Install Xcode from the Mac App Store.
  • Linux: Install the R development package, usually called r-devel or r-base-dev

Read las and laz files

At the R level

lasdata   = read.las("<myfile.las>")
lasheader = read.lasheader("<myfile.las>")

At the C++ level

Linking rlas into your c++ code.

// [[Rcpp::depends(rlas)]]

#include <rlasstreamer.h>

// [[Rcpp::export]]
List readlasdata(CharacterVector ifiles, CharacterVector filter)
{
  try
  {
    RLASstreamer lasstreamer(ifiles, filter);
    lasstreamer.allocation();
  
    while(lasstreamer.read_point())
    {
      lasstreamer.write_point();
    }
  
    return lasstreamer.terminate();
  }
  catch (std::exception const& ex)
  {
    Rcerr << "Error: " << ex.what() << std::endl;
    return(List(0));
  }
}

Changelog

See changelog here

Copyright Information

rlas contains code written by both Jean-Romain Roussel and Martin Isenburg. The latter is included for technical reasons. Details below.

  • For LASlib and LASzip:
  • For rlas code enabling Martin Isenburg's code to be wrapped into R:
    • (c) 2016 Jean-Romain Roussel
    • Provided under GPL-3 license.

Copy Link

Version

Install

install.packages('rlas')

Monthly Downloads

2,865

Version

1.2.0

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Jean-Romain Roussel

Last Published

April 9th, 2018

Functions in rlas (1.2.0)

check_data

Check if data and headers are correct
readlasheader

(deprecated) Read header from a .las or .laz file
write.las

Write a .las or .laz file
header_add_extrabytes

Variable length records tools
writelas

(deprecated) Write a .las or .laz file
writelax

Write a .lax file from a .las or .laz file
readlasdata

Read data from a .las or .laz file
read.lasheader

Read header from a .las or .laz file
read.las

Read data from a .las or .laz file
header_create

Public header block tools