Closed kulpojke closed 2 years ago
Protips: if your minimal reproducible example is more than 15 lines of code it is likely not an easily reproducible example. Here the data download failed for me. But I really appreciate you attempt at making something fully reproducible. Anyway I made my own MRE
library(lidR)
LASfile <- system.file("extdata", "MixedConifer.laz", package="lidR")
las <- readLAScatalog(LASfile)
f = tempfile(fileext = ".tif")
chm <- rasterize_canopy(las, 0.5, p2r(0.3))
terra::writeRaster(chm, f)
chm = terra::rast(f)
ttops <- locate_trees(las, lmf(4, 2))
future::plan(future::multisession)
opt_output_files(las) <- paste0(tempdir(), "/{XLEFT}_{YTOP}")
las <- segment_trees(las, dalponte2016(chm, ttops))
#> Error: NULL value passed as symbol address
This is an issue with terra
, the same you previously reported and the same reported in the discussion your linked but this time with a reproducible exemple. I'll fix it with the same workaround.
Hey I commented on the previous thread and am just commenting here again for visibility as this is the newer thread. What was the work around you ended up using here?
Casting to RasterLayer
internally and open an issue in terra https://github.com/rspatial/terra/issues/801 so the problem is fixed by terra developper. When the new version of terra will be released I will remove the workaound
This is similar to this previous issue, which never had a full resolution, and is probably related to this, which was an issue I had previously opened, and was resolved. This is basically the same problem as my last issue, but happening with
segment_trees
rather thannormalize_height
. Like my previous issue, it works withoutplan(multisesson)
. I have attached a reproduceable example. null_val_example.zipThe result:
The above code, and the files referenced within (downloads.txt and example.gpkg) are included in the zip