You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 than normalize_height. Like my previous issue, it works without plan(multisesson). I have attached a reproduceable example. null_val_example.zip
# import libraries
library(terra)
library(sf)
library(lidR)
library(future)
# tell lidR to use all available threads
set_lidr_threads(0)
# set up the future session
plan(multisession)
# path to data dir data<-"."# path to laz fileslidar<- file.path(data, "lidar")
# path to clipping gpkgpart1<- file.path(data, "example.gpkg")
# path to download listdownloads<- file.path(data, "downloadlist.txt")
# make dir for lidar files
dir.create(lidar, showWarnings=FALSE)
# get urlsurls<- readLines(downloads)
# download the lidar data from USGS (this seems un-necessarily complex)for(iin seq_along(urls)){
splt<- strsplit(urls[i], '/')
fname<- file.path(lidar, splt[[1]][length(splt[[1]])])
download.file(urls[i], fname, mode="wb")
}
# read the points into ctgctg<- readLAScatalog(lidar,
select="xyzcrnw",
filter="-drop_withheld -drop_class 9 18")
# plot
plot(ctg, chunk=TRUE)
#read gpkg, then buffer by 7maoi<- st_read(part1)
# verify
plot(aoi)
# make tempdir to hold results
opt_output_files(ctg) <- paste0(tempdir(), "/{XLEFT}_{YTOP}")
# clip to aoictg_aoi<- clip_roi(ctg, aoi)
# rechunk, redundant?
opt_chunk_size(ctg_aoi) <-400
opt_chunk_buffer(ctg_aoi) <-10# check it out
las_check(ctg_aoi)
# designate chm_path as output path
opt_output_files(ctg_aoi) <- paste0(tempdir(), "/{XLEFT}_{YTOP}")
# normalize, NOTE: Warnings about WKT CRS, probably not relevant?ctg_norm<- normalize_height(ctg_aoi, tin())
# keep ttops in memory
opt_output_files(ctg_norm) <-""# locate treesttops<- locate_trees(ctg_norm, lmf(4), uniqueness="bitmerge")
# how many duplicates, none here, seemingly always some in larger datastes
print(paste(length(ttops$treeID) - length(unique(ttops$treeID)), "duplicates"))
# remove duplicates#ttops <- st_cast(st_union(ttops), "POINT")# designate chm_path as output path
opt_output_files(ctg_norm) <- paste0(tempdir(), "/{XLEFT}_{YTOP}")
# make chmchm<- rasterize_canopy(ctg_norm, 0.5, pitfree(max_edge=c(0, 1.5)))
# designate outut path
opt_output_files(ctg_norm) <- paste0(tempdir(), "/{XLEFT}_{YTOP}")
# segmentation algorithmalgo<- dalponte2016(chm, ttops)
# segment HERE is the problem, always on first chunk to finishctg_segmented<- segment_trees(ctg_norm, algo)
The result:
Processing [===>--------------------------------------------------------------------------------] 5% (1/20) eta: 2mError:
NULL value passed as symbol address
The above code, and the files referenced within (downloads.txt and example.gpkg) are included in the zip
The text was updated successfully, but these errors were encountered:
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
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 rspatial/terra#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.zip
The result:
The above code, and the files referenced within (downloads.txt and example.gpkg) are included in the zip
The text was updated successfully, but these errors were encountered: