R/metrics_cloud.R

Defines functions cloud_metrics.LAScluster cloud_metrics.LAS cloud_metrics

Documented in cloud_metrics

#' @rdname aggregate
#' @name aggregate
#' @export
cloud_metrics = function(las, func, ...)
{
  UseMethod("cloud_metrics", las)
}

#' @export
cloud_metrics.LAS = function(las, func, ...)
{
  metrics <- template_metrics(las, func, st_bbox(las), ...)
  if (length(metrics) == 1L) return(metrics[[1]])
  return(metrics)
}

#' @export
cloud_metrics.LAScluster = function(las, func, ...)
{
  las <- readLAS(las)
  if (is.empty(las)) return(NULL)
  is_formula <- tryCatch(lazyeval::is_formula(func), error = function(e) FALSE)
  if (!is_formula) func <- lazyeval::f_capture(func)
  return(cloud_metrics(las, func,...))
}

Try the lidR package in your browser

Any scripts or data that you put into this service are public.

lidR documentation built on Sept. 11, 2024, 5:21 p.m.