tests/testthat/test-apply_autoread.R

test_that("catalog_apply autoread works", {

  skip_on_cran()

  ctg <- random_2files_250points
  opt_progress(ctg) = FALSE

  test <- function(las, bbox, layers = 1L) {
    sp <- as.spatial(las[1:10])
    sf <- sf::st_as_sf(sp)
    sf::st_agr(sf) <- "constant"
    sp <- sf::st_crop(sf, bbox)
    return(sp)
  }

  # automerge option
  option <- list(autoread = TRUE, automerge = TRUE)
  req2 <- catalog_apply(ctg, test, .options = option)

  expect_equal(nrow(req2), 20)
})

Try the lidR package in your browser

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

lidR documentation built on Sept. 8, 2023, 5:10 p.m.