-
-
Notifications
You must be signed in to change notification settings - Fork 130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
crown_metrics: scan() expected 'a real', got 'IllegalArgumentException: #701
Comments
Please sent a reproducible that takes less time. I try to reproduce with chm <- rasterize_canopy(las_cat, 1, p2r(0.2)) But it worked. Using |
ctg_segmented <- readLAS("D:/Lidar_2022/R/segment tree/missing_silva/folder1/f1segmented_589500_3690000.las")
##f1segmented_589500_3690000.las is a result of these codes
#opt_output_files(las_cat) <- "D:/Lidar_2022/R/segment tree/missing_silva/folder1/f1segmented_{XLEFT}_{YBOTTOM}"
#algo <- silva2016(chm, ttops2)
#ctg_segmented <- segment_trees(las_cat, algo)
opt_output_files(ctg_segmented) <- "D:/Lidar_2022/R/segment tree/missing_silva/folder1/f1canpoy_{XLEFT}_{YBOTTOM}"
#>Error in opt_chunk_size(ctg) : no slot of name "chunk_options" for this object of class "LAS"
segmentedtree<-crown_metrics(ctg_segmented, NULL, geom = "convex")
#> Warning message: 1 invalid polygons created. They likely correspond to trees with aligned points. I uploaded Shapefile of ttops and CHM. https://www.dropbox.com/scl/fo/v7i6a1p27yto9fo6t7vcd/h?rlkey=dk6q77kpiazxetvnlor1s37qw&dl=0 Thanks! |
I encountered the same issue. I was able to work around it by getting the crowns directly from the CHM:
And then converting the crowns to polygons, something like:
Oddly, sometimes crowns are returned as raster, sometimes as spatrast. |
Which is definitively a different output. You get the contour of the raster while
Please report an issue with a reproducible example. Thanks. |
So I reproduced the error with the following MRE: ctg_segmented = readLAScatalog("issue 701/f1segmented_589500_3690000.las")
segmentedtree<-crown_metrics(ctg_segmented, NULL, geom = "convex") But this works ctg_segmented = readLAS("issue701/f1segmented_589500_3690000.las")
segmentedtree<-crown_metrics(ctg_segmented, NULL, geom = "convex") Let's investigate. It is a very weird behavior |
The issue was the following:
#> Warning message: 1 invalid polygons created. They likely correspond to trees with aligned points.
I fixed the issue by always removing the invalid polygons in |
Thank you! |
Then, do you know if I need to download version 4.0.4? Could you please tell me how I can download 4.0.4. I only see the 4.0.3 from the "Release" tab. |
You need to get the development version from Github (or wait until it is released to cran). install.packages("devtools")
library(devtools)
install_github("r-lidar/lidR")
library(lidR) |
I really appreciate it. I confirmed it works! |
I confirmed that the error occurred regardless of number of las files in las catalog.
This error was confirmed. But I am not sure whether the latest version of lidR fixed it.
I don't know how I can download version 4.0.4 so, I used version 4.0.3.
Here is my code.
It gave me an error below.
Here is a single las file that I used for.
The text was updated successfully, but these errors were encountered: