v2.1.0
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
-
readLAS()
:- LAS 1.4 and point formats > 6 are now better suported.
lascheck()
andprint()
were updated to work correctly with these formats (#204) - New function
readLASheader()
to read the header of a file in aLASheader
object.
- LAS 1.4 and point formats > 6 are now better suported.
-
Coordinate Reference System:
- New function
wkt()
to store a WKT CRS in a LAS 1.4 file. This function is the twin ofepsg()
to store CRS. It updates theproj4string
and the header of the LAS object. This function is not expected to be used by users. Users must prefer the new functionprojection()
instead. - New function
projection<-
that updates both the slotproj4string
and the header with an EPSG code or a WKT string from aproj4string
or asp:CRS
object. This function supersedesepsg()
andwkt()
that are actually only useful internally and in specific cases. The vignetteLAS-class
has been updated accordingly.
projection(las) <- projection(raster)
- New function
-
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)
-
grid_metrics()
:- New function
stdshapemetrics()
and lazy coding.stdshapemetrics
to compute eigenvalue-related features (#217). - New argument
filter
ingrid_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)
- New function
-
New functions
lasdetectshape()
for water and human-made structure detection with three algorithmsshp_plane()
,shp_hplane()
,shp_line()
. -
plot()
:- For LAS objects
plot()
gained an argumentaxis = TRUE
to display axis. - For LAS objects
plot()
gained an argumentlegend = TRUE
to display color gradient legend (#224).
- For LAS objects
-
tree_hull()
:- Gained an argument
func
to compute metrics for each tree, liketree_metrics()
convhulls <- tree_hulls(las, func = ~list(imean = mean(Intensity)))
- Gained an argument
-
Miscellaneous tools:
- The function
area()
has been extended toLASheader
objects. - New functions
npoints()
anddensity()
available forLAS
,LASheader
andLAScatalog
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
- The function
-
Several functions are natively parallelized at the C++ level with OpenMP. See
help("lidR-parallelism")
for more details. -
New function
catalog_select
for interactive tile selection.
NOTE
-
grid_metrics()
,grid_metrics3d()
,tree_metrics()
,tree_hull()
,grid_hexametrics()
andlasmetrics()
expect a formula as input. Users should not writegrid_metrics(las, mean(Z))
butgrid_metrics(las, ~mean(Z))
. The first syntax is still valid, for now. -
The argument named
field
intree_metrics()
is now namedattribute
for consistency with all other functions. -
The documentation of supported options in
tree_*()
functions was inccorect and has been fixed. -
readLAScatalog()
replacescatalog()
.catalog()
is soft-deprecated.
FIX
- #264
grid_terrain
now filter degenerated ground points.