knnidw: Spatial Interpolation Algorithm

Description Usage Arguments See Also Examples

View source: R/algorithm-spi.R

Description

This function is made to be used in grid_terrain or normalize_height. It implements an algorithm for spatial interpolation. Interpolation is done using a k-nearest neighbour (KNN) approach with an inverse-distance weighting (IDW).

Usage

1
knnidw(k = 10, p = 2, rmax = 50)

Arguments

k

integer. Number of k-nearest neighbours. Default 10.

p

numeric. Power for inverse-distance weighting. Default 2.

rmax

numeric. Maximum radius where to search for knn. Default 50.

See Also

Other spatial interpolation algorithms: kriging(), tin()

Examples

1
2
3
4
5
6
7
8
9
LASfile <- system.file("extdata", "Topography.laz", package="lidR")
las = readLAS(LASfile)

#plot(las)

dtm = grid_terrain(las, algorithm = knnidw(k = 6L, p = 2))

#plot(dtm, col = terrain.colors(50))
#plot_dtm3d(dtm)

Example output

Loading required package: raster
Loading required package: sp
Warning message:
In showSRID(SRS_string, format = "PROJ", multiline = "NO", prefer_proj = prefer_proj) :
  Discarded datum NAD83 Canadian Spatial Reference System in CRS definition
sh: 1: awk: Permission denied
sh: 1: awk: Permission denied

lidR documentation built on June 21, 2021, 5:07 p.m.