# NOT RUN {
#- import the tree_line_plot dataset
file <- system.file("extdata", "tree_line_plot.laz", package="viewshed3d")
tls <- lidR::readLAS(file,select="xyz")
#- class ground and vegetation points
class <- lidR::classify_ground(tls, lidR::csf(rigidness = 1L,
class_threshold = 0.2,
sloop_smooth = FALSE))
#- reconstruct the ground. Here the ground is reconstructed with the user
#- defined resolution only.
recons <- viewshed3d::reconstruct_ground(data=class,position = c(0,0,3),
ground_res = 0.05,
angular_res = 2,
method="knnidw")
lidR::plot(recons,color="Classification",
colorPalette = c("darkgreen","chocolate4"))
#- when the position is closer to the ground, the user defined resolution is
#- not sufficient and a second grid is added with the optimal resolution so
#- that no sightline can pass trough the ground when computing visibility.
#- In this example, full_raster = TRUE was used as a portion of the ground
#- near the animal location is not reconstructed because of a data
#- gap around a TLS scan position when using full_raster = FALSE.
recons <- viewshed3d::reconstruct_ground(data=class,position = c(0,0,1),
ground_res = 0.05,
angular_res = 2,
method="knnidw",
full_raster = TRUE)
lidR::plot(recons,color="Classification",
colorPalette = c("darkgreen","chocolate4"))
# }
Run the code above in your browser using DataLab