Skip to content

v2.1.0

Compare
Choose a tag to compare
@Jean-Romain Jean-Romain released this 12 Jul 22:51
· 1210 commits to master since this release

lidR v2.1.0

VISIBLE CHANGES

Several algorithms are now natively parallelized at the C++ level with OpenMP. This has for consequences for speed-up of some computations by default but implies visible changes for users. For more details see help("lidR-parallelism"). The following only explains how to modify code to restore the exact former behavior.

In versions < 2.1.0 the catalog processing engine has R-based parallelism capabilities using the future package. The addition of C++-based parallelism introduced additional complexity. To prevent against nested parallelism and give the user the ability to use either R-based or C++-based parallelism (or a mix of the two), the function opt_cores() is no longer supported. If used it generates a message and does nothing. The strategy used to process the tiles in parallel must now be explicitly declared by users. This is anyway how it should have been designed from the begining! For users, restoring the exact former behavior implies only one change.

In versions < 2.1.0 the following was correct:

library(lidR)
ctg <- catalog("folder/")
opt_cores(ctg) <- 4L
hmean <- grid_metrics(ctg, mean(Z))

In versions >= 2.1.0 this must be explicitely declared with the future package:

library(lidR)
library(future)
plan(multisession)
ctg <- catalog("folder/")
hmean <- grid_metrics(ctg, mean(Z))

NEW FEATURES

  1. readLAS():

    • LAS 1.4 and point formats > 6 are now better suported. lascheck() and print() were updated to work correctly with these formats (#204)
    • New function readLASheader() to read the header of a file in a LASheader object.
  2. Coordinate Reference System:

    • New function wkt() to store a WKT CRS in a LAS 1.4 file. This function is the twin of epsg() to store CRS. It updates the proj4string and the header of the LAS object. This function is not expected to be used by users. Users must prefer the new function projection() instead.
    • New function projection<- that updates both the slot proj4string and the header with an EPSG code or a WKT string from a proj4string or a sp:CRS object. This function supersedes epsg()and wkt() that are actually only useful internally and in specific cases. The vignette LAS-class has been updated accordingly.
    projection(las) <- projection(raster)
  3. LAScatalog processing engine:

    • Progression estimation displayed on a map now handles warnings by coloring the chunks in orange.
    • Progression estimation displayed on a map now colors in blue the chunks that are processing.
    • The engine now returns the partial result in case of a fail.
    • The engine now has a log system to help users reload the chunk that throws an error and try to understand what going wrong with this cluster specifically. If something went wrong a message like the following is displayed:
    An error occurred when processing the chunk 190. Try to load this chunk with:
    chunk <- readRDS("/tmp/RtmpAlHUux/chunk190.rds")
    las <- readLAS(chunk)
    
  4. grid_metrics():

    • New function stdshapemetrics() and lazy coding .stdshapemetrics to compute eigenvalue-related features (#217).
    • New argument filter in grid_metrics(). This argument enables users to compute metrics on a subset of selected points such as "first returns", for example, without creating a copy of the point cloud. Such an argument is expected to be added later in several other functions.
    hmean <- grid_metrics(las, ~mean(Z), 20, filter = ~ReturnNumber == 1)
  5. New functions lasdetectshape() for water and human-made structure detection with three algorithms shp_plane(), shp_hplane(), shp_line().

  6. plot():

    • For LAS objects plot() gained an argument axis = TRUE to display axis.
    • For LAS objects plot() gained an argument legend = TRUE to display color gradient legend (#224).
  7. tree_hull():

    • Gained an argument func to compute metrics for each tree, like tree_metrics()
    convhulls <- tree_hulls(las, func = ~list(imean = mean(Intensity)))
  8. Miscellaneous tools:

    • The function area() has been extended to LASheader objects.
    • New functions npoints() and density() available for LAS, LASheader and LAScatalog objects that return what users may expect.
    las    <- readLAS("file.las", filter = "-keep_first")
    header <- readLASheader(file)
    ctg    <- catalog("folder/")
    
    npoints(las)    #> [1] 55756
    npoints(header) #> [1] 81590
    npoints(ctg)    #> [1] 1257691
    
    density(las)    #> [1] 1.0483
    density(header) #> [1] 1.5355
    density(ctg)    #> [1] 1.5123
  9. Several functions are natively parallelized at the C++ level with OpenMP. See help("lidR-parallelism") for more details.

  10. New function catalog_select for interactive tile selection.

NOTE

  1. grid_metrics(), grid_metrics3d(), tree_metrics(), tree_hull(), grid_hexametrics() and lasmetrics() expect a formula as input. Users should not write grid_metrics(las, mean(Z)) but grid_metrics(las, ~mean(Z)). The first syntax is still valid, for now.

  2. The argument named field in tree_metrics() is now named attribute for consistency with all other functions.

  3. The documentation of supported options in tree_*() functions was inccorect and has been fixed.

  4. readLAScatalog() replaces catalog(). catalog() is soft-deprecated.

FIX

  1. #264 grid_terrain now filter degenerated ground points.