reconstruct_ground: Optimal ground reconstruction for visibility computation

Description Usage Arguments Value Examples

View source: R/reconstruct_ground.R

Description

Reconstructs the ground surface with a grid resolution defined by the user and adds a second grid around the animal position with an optimal resolution so that no sightline can pass through the ground when computing visibility with the visibility function.

Usage

1
2
3
4
5
6
7
8
9
reconstruct_ground(
  data,
  ground_res,
  position,
  angular_res,
  method,
  full_raster,
  ...
)

Arguments

data

LAS class object containing a 3d point cloud + a Classification field that classes points as ground and non-ground, as provided by the classify_ground function from the lidR-package.

ground_res

numeric. The grid resolution to reconstruct the ground on the entire 3D scene. Default = 0.05. NOTE: a if needed, second grid may be added with smaller (internally computed) resolution.

position

vector of length 3 containing the xyz coordinates of the animal position when computing the visibility with the visibility function. Default = c(0,0,0).

angular_res

numeric. The angular resolution of sightlines when computing the visibility with the visibility function. Default = 1.

method

which algorithm to use for spatial interpolation. Can be "knnidw", "tin" or "kriging". See documentation from the lidR-package for knnidw, tin and kriging.

full_raster

should the entire raster be interpolated for the ground portion around the animal position? Parameter passed to the grid_terrain function available in the lidR-package.

...

other arguments to pass to the spatial interpolation algorithm. See documentation from knnidw, tin and kriging

Value

A LAS class object containing the 3D point cloud coordinates with the ground reconstructed to be passed directly to the visibility function. Note: the Classification field is preserved.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#- 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"))

viewshed3d documentation built on April 4, 2021, 1:06 a.m.