diff --git a/R/algorithm-dec.R b/R/algorithm-dec.R index a40e410d..338b453b 100644 --- a/R/algorithm-dec.R +++ b/R/algorithm-dec.R @@ -19,8 +19,8 @@ #' #' # Reach a pulse density of 1 on the overall dataset #' thinned1 = decimate_points(las, random(1)) -#' plot(grid_density(las)) -#' plot(grid_density(thinned1)) +#' plot(rasterize_density(las)) +#' plot(rasterize_density(thinned1)) #' @name sample_random random = function(density, use_pulse = FALSE) { @@ -91,7 +91,7 @@ random = function(density, use_pulse = FALSE) #' #' # Select points randomly to reach an homogeneous density of 1 #' thinned <- decimate_points(las, homogenize(1,5)) -#' plot(grid_density(thinned, 10)) +#' plot(rasterize_density(thinned, 10)) #' @name sample_homogenize homogenize = function(density, res = 5, use_pulse = FALSE) { diff --git a/R/algorithm-dtm.R b/R/algorithm-dtm.R index 821dce88..7465d7e4 100644 --- a/R/algorithm-dtm.R +++ b/R/algorithm-dtm.R @@ -99,13 +99,13 @@ knnidw = function(k = 10, p = 2, rmax = 50) #' #' This function is made to be used in \link{rasterize_terrain} or \link{normalize_height}. It #' implements an algorithm for spatial interpolation. Spatial interpolation is based on universal -#' kriging using the \link[gstat:krige]{krige} function from \code{gstat}. This method combines the +#' kriging using the `krige()` function from \code{gstat}. This method combines the #' KNN approach with the kriging approach. For each point of interest it kriges the terrain using #' the k-nearest neighbour ground points. This method is more difficult to manipulate but it is also #' the most advanced method for interpolating spatial data. #' #' @param k numeric. Number of k-nearest neighbours. Default 10. -#' @param model A variogram model computed with \link[gstat:vgm]{vgm}. If NULL it performs an ordinary +#' @param model A variogram model computed with `vgm()` from package `gstat`. If NULL it performs an ordinary #' or weighted least squares prediction. #' #' @export @@ -125,6 +125,7 @@ knnidw = function(k = 10, p = 2, rmax = 50) #' plot_dtm3d(dtm) #' } #' @name dtm_kriging +#' @md kriging = function(model = gstat::vgm(.59, "Sph", 874), k = 10L) { assert_package_is_installed("gstat") diff --git a/R/plot.R b/R/plot.R index 525acf5e..51199c76 100644 --- a/R/plot.R +++ b/R/plot.R @@ -2,7 +2,7 @@ #' #' Plot displays a 3D interactive windows based on rgl for \link{LAS} objects\cr\cr #' Plot displays an interactive view for \link[=LAScatalog-class]{LAScatalog} objects with pan and -#' zoom capabilities based on \link[mapview:mapview-package]{mapview}. If the coordinate reference +#' zoom capabilities based on `mapview()` from package `mapview`. If the coordinate reference #' system (CRS) of the \code{LAScatalog} is non empty, the plot can be displayed on top of base maps #' (satellite data, elevation, street, and so on).\cr\cr #' Plot displays a \link[=LASheader-class]{LASheader} object exactly like it displays a LAScatalog @@ -46,7 +46,7 @@ #' @param overlaps logical. Highlight the overlaps between files. #' #' @param ... Will be passed to \link[rgl:3dobjects]{points3d} (LAS) or \link[graphics:plot.default]{plot} -#' if \code{mapview = FALSE} or to \link[mapview:mapView]{mapview} if \code{mapview = TRUE} (LAScatalog). +#' if \code{mapview = FALSE} or to `mapview()` if \code{mapview = TRUE} (LAScatalog). #' #' @examples #' \dontrun{ diff --git a/R/utils_threads.R b/R/utils_threads.R index 1edb85f3..3fed22f9 100644 --- a/R/utils_threads.R +++ b/R/utils_threads.R @@ -86,7 +86,7 @@ get_lidr_threads = function() #' @noRd try_to_get_num_future_cores = function() { - if (!"future" %in% rownames(installed.packages())) + if (!"future" %in% rownames(utils::installed.packages())) return(1L) # nocov start diff --git a/man/dtm_kriging.Rd b/man/dtm_kriging.Rd index a2a2ec1d..10ba64a4 100644 --- a/man/dtm_kriging.Rd +++ b/man/dtm_kriging.Rd @@ -8,7 +8,7 @@ kriging(model = gstat::vgm(0.59, "Sph", 874), k = 10L) } \arguments{ -\item{model}{A variogram model computed with \link[gstat:vgm]{vgm}. If NULL it performs an ordinary +\item{model}{A variogram model computed with \code{vgm()} from package \code{gstat}. If NULL it performs an ordinary or weighted least squares prediction.} \item{k}{numeric. Number of k-nearest neighbours. Default 10.} @@ -16,7 +16,7 @@ or weighted least squares prediction.} \description{ This function is made to be used in \link{rasterize_terrain} or \link{normalize_height}. It implements an algorithm for spatial interpolation. Spatial interpolation is based on universal -kriging using the \link[gstat:krige]{krige} function from \code{gstat}. This method combines the +kriging using the \code{krige()} function from \code{gstat}. This method combines the KNN approach with the kriging approach. For each point of interest it kriges the terrain using the k-nearest neighbour ground points. This method is more difficult to manipulate but it is also the most advanced method for interpolating spatial data. diff --git a/man/plot.Rd b/man/plot.Rd index 4a602166..faf8fadb 100644 --- a/man/plot.Rd +++ b/man/plot.Rd @@ -50,7 +50,7 @@ pastel.colors(n) \item{y}{Unused (inherited from R base)} \item{...}{Will be passed to \link[rgl:3dobjects]{points3d} (LAS) or \link[graphics:plot.default]{plot} -if \code{mapview = FALSE} or to \link[mapview:mapView]{mapview} if \code{mapview = TRUE} (LAScatalog).} +if \code{mapview = FALSE} or to `mapview()` if \code{mapview = TRUE} (LAScatalog).} \item{color}{characters. The attribute used to color the point cloud. Default is Z coordinates. RGB is an allowed string even if it refers to three attributes simultaneously.} @@ -104,7 +104,7 @@ Since v4.0.4 `mapview = TRUE` is also possible with LAS objects.} \description{ Plot displays a 3D interactive windows based on rgl for \link{LAS} objects\cr\cr Plot displays an interactive view for \link[=LAScatalog-class]{LAScatalog} objects with pan and -zoom capabilities based on \link[mapview:mapview-package]{mapview}. If the coordinate reference +zoom capabilities based on `mapview()` from package `mapview`. If the coordinate reference system (CRS) of the \code{LAScatalog} is non empty, the plot can be displayed on top of base maps (satellite data, elevation, street, and so on).\cr\cr Plot displays a \link[=LASheader-class]{LASheader} object exactly like it displays a LAScatalog diff --git a/man/sample_homogenize.Rd b/man/sample_homogenize.Rd index 8b5d6f24..b12aa7c5 100644 --- a/man/sample_homogenize.Rd +++ b/man/sample_homogenize.Rd @@ -32,7 +32,7 @@ las = readLAS(LASfile, select = "xyz") # Select points randomly to reach an homogeneous density of 1 thinned <- decimate_points(las, homogenize(1,5)) -plot(grid_density(thinned, 10)) +plot(rasterize_density(thinned, 10)) } \seealso{ Other point cloud decimation algorithms: diff --git a/man/sample_random.Rd b/man/sample_random.Rd index e6ef5a01..c346b691 100644 --- a/man/sample_random.Rd +++ b/man/sample_random.Rd @@ -24,8 +24,8 @@ las = readLAS(LASfile, select = "xyz") # Reach a pulse density of 1 on the overall dataset thinned1 = decimate_points(las, random(1)) -plot(grid_density(las)) -plot(grid_density(thinned1)) +plot(rasterize_density(las)) +plot(rasterize_density(thinned1)) } \seealso{ Other point cloud decimation algorithms: diff --git a/tests/testthat/test-classify_ground.R b/tests/testthat/test-classify_ground.R index b6decbcf..53da475b 100644 --- a/tests/testthat/test-classify_ground.R +++ b/tests/testthat/test-classify_ground.R @@ -11,11 +11,10 @@ opt_progress(ctg) <- FALSE ws = seq(3,21, 5) th = seq(0.1, 2, length.out = length(ws)) -mypmf = pmf(ws, th) -mycsf = csf(TRUE, 1, 1, time_step = 1) - test_that("classify_ground pmf works with LAS", { + mypmf = pmf(ws, th) + las <- classify_ground(las, mypmf) n = names(las) @@ -30,6 +29,8 @@ test_that("classify_ground pmf works with LAS", { test_that("classify_ground pmf works with LAScatalog", { opt_chunk_buffer(ctg) <- 30 + mypmf = pmf(ws, th) + expect_error(classify_ground(ctg, mypmf), "output file") opt_output_files(ctg) <- paste0(tempdir(), "/file_{XLEFT}_{YBOTTOM}") @@ -44,6 +45,8 @@ test_that("classify_ground csf works with LAS", { skip_if_not_installed("RCSF") + mycsf = csf(TRUE, 1, 1, time_step = 1) + las <- classify_ground(las, mycsf) n = names(las) @@ -58,6 +61,8 @@ test_that("classify_ground csf works with LAScatalog", { skip_if_not_installed("RCSF") skip_on_cran() + mycsf = csf(TRUE, 1, 1, time_step = 1) + opt_output_files(ctg) <- paste0(tempdir(), "/file_{XLEFT}_{YBOTTOM}_ground") opt_chunk_buffer(ctg) <- 30 @@ -102,7 +107,7 @@ test_that("makeZhangParam works", { }) test_that("classify_ground does not erase former classification (but new ground points)", { - + mypmf = pmf(ws, th) las <- topography las <- filter_poi(las, X < mean(X), Y < mean(Y)) las$Classification[las$Classification == LASGROUND] <- LASUNCLASSIFIED diff --git a/tests/testthat/test-print.R b/tests/testthat/test-print.R index 4d1cfddf..1dfdfa47 100644 --- a/tests/testthat/test-print.R +++ b/tests/testthat/test-print.R @@ -66,7 +66,7 @@ test_that("print works with lidR algorithms ", { k <- tin() j <- p2r(2) l <- random(2) - m <- csf() + m <- pmf(3,4) #o <- wing2015() p <- Roussel2020()