I'm following the steps in The lidRbook Chapter 7.1 to get tree tops. I want to plot the tree tops and point cloud data as illustrated in the book, however, I want to use lidRviewer as it runs much smoother than rgl.

My point cloud dataset is a LAS file and my tree tops are a sf. Is this possible? We can use the example data from the book to test. Please note you need to install both OpenGL and the SDL libraries before installing lidRviewer.

#run on the command line 
sudo apt-get install libsdl-dev freeglut3-dev

###in r

LASfile <- system.file("extdata", "MixedConifer.laz", package="lidR")
las <- readLAS(LASfile, select = "xyzr", filter = "-drop_z_below 0")
chm <- rasterize_canopy(las, 0.5, pitfree(subcircle = 0.2))
plot(las, bg = "white", size = 4)
ttops <- locate_trees(las, lmf(ws = 5))

plot(chm, col = height.colors(50))
plot(sf::st_geometry(ttops), add = TRUE, pch = 3)

#this section is what I want to change to run with lidRviewer
x <- plot(las, bg = "white", size = 4)
add_treetops3d(x, ttops)

1 Answer 1


I'm citing the readme of the lidRviewer package

Can only display point clouds. No other feature. This is only a point cloud displayer so not intended as a replacement for rgl.

In short, it is not possible. rgl is awesome, and you can guess that a little inactive project like lidRviewer won't replace it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.