0

i am quite new to R and RStudio, i am currently working with a large set of point cloud data (~450 files), when I try to get the crowns attributes with catalog_map(), I find that the output of the result sometimes being a single sf object (when doing testing with a few LAS files), sometimes being a list of sf objects(when working with whole set of 450files).

should this be expected or did i miss anything? or how to programmatically tell and bind the list before saving the result with st_write?

3
  • At what poijnt between "a few LAS files" and "a whole set of 450 files" does the behaviour change? Can you provide example code of what you are doing with catalog_map (since it might be related to your function)?
    – Spacedman
    Commented Sep 28, 2023 at 8:53
  • @Spacedman Thanks for the reply the code is as follow f_treecrown <- function(las){ nlas <- normalize_height(las, knnidw()) tree_tops <- locate_trees(nlas, lmf(ws = getWS, hmin = 20)) chm <- rasterize_canopy(nlas, 0.3, pitfree(subcircle = 0.2)) smooth_chm <- terra::focal(chm, w, fun = mean, na.rm = TRUE) tree <- segment_trees(nlas, silva2016(smooth_chm, tree_tops, max_cr_factor = 0.44, exclusion = 0.25, ID="treeID")) crowns <- crown_metrics( tree, type = "convex", func = .stdtreemetrics, attribute = "treeID", geom = "convex") return(crowns) } Commented Sep 29, 2023 at 17:54
  • opt <- list(automerge = TRUE) # catalog_apply will merge the outputs into a single object output = NULL output <- catalog_map(las_catg, f_treecrown, .options = opt) Commented Sep 29, 2023 at 17:55

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.