Airborne LiDAR (Light Detection and Ranging) interface for data manipulation and visualization. Read/write 'las' and 'laz' files, computation of metrics in area based approach, point filtering, artificial point reduction, classification from geographic data, normalization, individual tree segmentation and other manipulations.
R package for Airborne LiDAR Data Manipulation and Visualization for Forestry Applications
The lidR package provides functions to read and write
.laz files, plot point clouds, compute metrics using an area-based approach, compute digital canopy models, thin lidar data, manage a catalog of datasets, automatically extract ground inventories, process a set of tiles using multicore processing, individual tree segmentation, classify data from geographic data, and provides other tools to manipulate LiDAR data in a research and development context.
In R-fashion style the function
plot, based on
rgl, enables the user to display, rotate and zoom a point cloud. Because
rgl has limited capabilities with respect to large datasets, we also made a package PointCloudViewer with greater display capabilites.
las = readLAS("<file.las>")plot(las)
lidR has several algorithms from the literature to compute canopy height models either point-to-raster based (
grid_canopy) or triangulation based (
grid_tincanopy). This allows testing and comparison of some methods that rely on a CHM, such as individual tree segmentation or the computation of a canopy roughness index.
las = readLAS("<file.las>")# Khosravipour et al. pitfree algorithmth = c(0,2,5,10,15)edge = c(0, 1.5)chm = grid_tincanopy(las, thresholds = th, max_edge = edge)plot(chm)
lidR enables the user to manage, use and process a catalog of
las files. The function
catalog builds a
LAScatalog object from a folder. The function
plot displays this catalog on an interactive map using the
ctg = catalog("<folder/>")[email protected] = sp::CRS("+proj=utm +zone=17")# CRS set: will be displayed on an interactive mapplot(ctg)
LAScatalog object the user can (for example) extract some regions of interest (ROI) with
catalog_queries. Using a catalog for the extraction of the ROI guarantees fast and memory-efficient clipping.
LAScatalog objects allow many other manipulations that are usually done with multicore processing, where possible.
lastrees function has several algorithms from the literature for individual tree segmentation, based either on the digital canopy model or on the point-cloud. Each algorithm has been coded from the source article to be as close as possible to what was written in the peer-reviwed papers. Our goal is to make published algorithms usable, testable and comparable.
las = readLAS("<file.las>")lastrees(las, algorithm = "li2012")col = random.colors(200)plot(las, color = "treeID", colorPalette = col)
lidR has many other tools and is a continuouly improved package. If it does not exist in
lidR please ask us for a new feature, and depending on the feasability we will be glad to implement your requested feature.
devtools::install_github("Jean-Romain/rlas", dependencies=TRUE)devtools::install_github("Jean-Romain/lidR", dependencies=TRUE)
devtools::install_github("Jean-Romain/rlas", dependencies=TRUE, ref="devel")devtools::install_github("Jean-Romain/lidR", dependencies=TRUE, ref="devel")
To install the package from github make sure you have a working development environment.
Xcodefrom the Mac App Store.
tree_hullsthat computes a convex or concave hull for each segmented tree.
stop_earlythat enables processing of an entire catolog or stops if an error occurs.
catalog_retilesupersedes the function
catalog_reshapeand performs the same task while adding much more functionality.
LAScatalog, error handling has been seriouly improved. A process can now run until the end even with errors. In this case clusters with errors are skipped.
LAScatalog, the graphical progress now uses 3 colors. green: ok, red: error, gray: null.
LASobject preserves the CRS.
plot.LAScatalogalways displays the catalog with
mapviewby default even if the CRS is empty.
lastrees_dalpontethe matching between the seeds and the canopy is more tolerant. Rasters can have different resolution and/or extent.
lasgrounduses (as an option) only the last and single returns to perform the segmentation.
catalog()displays a message when finding overlaps between files.
lasscanline()did not compute the scanline because the conditional statement that checked if the field was properly populated was incorrect.
tree_detectionwhen used with a point cloud was not properly coded and tended to miss some trees.
ofilewas non empty, the function wrote properly the file but returned a non-expected error.
futureand some function were missing. User supplied function is now manually analysed.
lasclipwas used with a
LAScatalogwas wrongly computed for non square tiles because of a bad copy/paste in the code.
NULLclass objects returned by
grid_*functions when processing a
LAScatalogif the first cluster is empty.
NAif not computable.
catalog_options()is formally deprecated. Use
LAScatalogproperties instead (see
magrittris no longer loaded with
lidR. Thus, piping operators are no longer usable by default. To use piping operators use
lassmoothfunction. A point cloud-based smoothing function.
lasfiltersurfacepointsfunction to filter surface points.
grid_catalogfunction is a simplified and more powerful function like
catalog_applybut specifically dedicated to
lasaddextrabyte_manualto add new data in a
lasclipcan clip a
lasclipCirclecan clip multiple selections (non-documented feature).
lastrees_*functions can now be written in a
las/lazfile by default.
LAScatalogobjects are processed with a single core by default.
lasdecimateis formally deprecated. Use
grid_densitynow returns both the point and the pulse density, where possible.
Pis no longer set by default in
lastreeshas been split into several pages.
grid_metrics(lidar, stdmetrics_i(Intensity))returned and empty
lasclassifywhen using the shapefile's table of attributes as data.
field = NULLin
NAreturn in entropy when negative value are found.
starthas been enabled in
lasclip*can extract from a catalog.
lastreesgains a new algorithm from Silva et al. (2016).
lastreeswith the Li et al. (2012) algorithm gains a new parameter to prevent over-segmentation.
lassnagsfor classifying points as snag points or for segmenting snags.
tree_detectionto detect individual trees. This feature has been extracted from
lastrees's algorithms and it is now up to the users to use
lidR's algos or other input sources.
plotsupports natively the
PointCloudViewerpackage available on github.
lastreeswith the Li et al. (2012) algorithm is now 5-6 times faster and much more memory efficient.
lastreeswith the Li et al. (2012) algorithm no longer sorts the original point cloud.
lastreeswith the Dalponte et al (2016) algorithm is now computed in linear time and is therefore hundreds to millions times faster.
catalog_reshape()streams the data and uses virtually zero memory to run.
grid_canopy()has been rewritten entirely in C++ and is now 10 to 20 times faster both with the option
subcircleor without it.
grid_canopy()with the option
subcircleuses only 16 bytes of extra memory to run, while this feature previously required the equivalent of several copies of the point cloud (several hundreds of MB).
as.raster()is now three times faster.
lasclassifynow uses a QuadTree and is therefore faster. This enables several algorithms to run faster, such as
lastreeswith Silva's algo.
lasgroundwith the PMF algorithm now accepts user-defined sequences.
lasgroundwith the PMF algorithm has simplified parameter names to make them easier to type and understand, and to prepare the package for new algorithms.
lasgrounddocumentation is more explicit about the actual algorithm used.
lasgroundnow computes the windows size more closely in line with the original Zhang paper.
lastreeswhen used with raster-based methods now accepts a missing las object. In that case
extrais turned to
p(for power) added to functions that enable spatial interpolation with IDW.
This version is dedicated to extending functions and processes to entire catalogs in a continuous way. Major changes are:
catalog_applyworks. More powerful but no longer compatible with previous releases
catalog_applyhas been entirely re-designed. It is more flexible, more user-friendly and enables loading of buffered data.
catalog_querieshas now an argument
...to pass any argument of
catalog_querieshas now an argument
bufferto load extra buffered points around the region of interest.
grid_metricsaccepts a catalog as input. It allows users to grid an entire catalog in a continuous way.
grid_densityalso inherits this new feature
grid_terrainalso inherits this new feature
grid_canopyalso inherits this new feature
grid_tincanopyalso inherits this new feature
grid_metricshas now has an argument
filterfor streaming filters when used with a catalog
lasnormalizeupdates the point cloud by reference and avoids making deep copies. An option
copy = TRUEis available for compatibility with former versions.
readLASarguments changed. The new syntax is simpler. The previous syntax is still supported.
catalog_indexis no longer an exported function. It is now an internal function.
plot.Catalogaccepts the usual
catalog_applydo not expect a parameter
mc.cores. This is now driven by global options in
lasmetricsdo not expect a parameter
debug. This is now driven by global options in
catalogcan build a catalog from a set of paths to files instead of a path to a folder.
$access to LAS attribute (incredibly slow)
catalog_selectis more pleasant an more interactive to use.
Catalogclass is now a S4
LAScatalogclass gain a slot
crsautomatically filled with a proj4 string
plot.LAScatalogdisplay a google map background if the catalog has a CRS.
plot.LAScataloggains an argument
yto display a either a terrain, road, satellite map.
lasareais deprecated. Use the more generic function
writeLASfor skipped fields when no field is skipped is now correct.
grid_terrainwith delaunay allocates less memory, makes fewer deep copies and is 2 to 3 times faster
grid_terrainwith knnidw allocates less memory, makes fewer deep copies and is 2 to 3 times faster
lasclassifyno longer rely on
raster::extractbut on internal
fast_extract, which is memory efficient and more than 15 times faster.
LAScatalogto be built 8 times faster than previously.
RANNpackage using internal k-nearest neighbor search (2 to 3 times faster)
grid_tincanopy()gains a parameter
rumple_indexfor measuring roughness of a digital model (terrain or canopy)
x > 0was replaced by
x >= 0to avoid errors in the canopy height models
lastreesLi et al. algorithm for tree segmentation is now ten to a thousand of times faster than in v1.2.0
grid_terrain, the interpolation is now done only within the convex hull of the point cloud
grid_tincanopymakes the triangulation only for highest return per grid cell.
grid_terrainusing Delaunay triangulation is now ten to a hundred times faster than in v1.2.0
as.rasternow relies on
spand is more flexible
as.rasterautomatically returns a
RasterStackif no layer is provided.
as.rasterchanges and can display a
lasgroundfor ground segmentation.
grid_tincanopy. Canopy height model using Khosravipour et al. pit-free algorithm.
grid_hexametrics. Area-based approach in hexagonal cells.
lasnormalizeallows for "non-discretized" normalization i.e interpolating each point instead of using a raster.
lascheckperforms more tests to check if the header is in accordance with the data.
gap_fraction_profile()bug with negative values (thanks to Florian de Boissieu)
max(Z) = 0
grid_terrain, forcing the lowest point to be retained is now an option
keep_lowest = FALSE
lastree()for individual tree segmentation
readLAS()gains a parameter
rlas (>= 1.1.0)
rlas (>= 1.1.0). It saves a lot of memory, is 2 to 6 times faster and supports .lax files.
plot.LAS()now expects a list of colors instead of a function. Use
akimais now called
delaunaybecause it corresponds to what is actually computed.
akimalost its parameter
krigingnow performs a KNN kriging.
catalog_queries()lost the parameter
...all the fields are loaded by default.
lasterrain()which was not consistent with other functions and not useful.
Number of point recordsand
Number of nth return.
lasnormalize()updates the header and returns warnings for some behaviors
Second submission - rejected
First submission - rejected