Skip to content
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

Irrelevant CHM or error for some specific resolution #552

Closed
Jean-Romain opened this issue Mar 22, 2022 · 1 comment
Closed

Irrelevant CHM or error for some specific resolution #552

Jean-Romain opened this issue Mar 22, 2022 · 1 comment
Assignees
Labels
Bug A bug in the package

Comments

@Jean-Romain
Copy link
Collaborator

Jean-Romain commented Mar 22, 2022

From #550 by @poornima-s10

I have recently started using lidR and have run into some issues with rasterize_canopy. [...] I have a ground classified/normalised point cloud. I am using LAScatalog mainly but in this case have tested both LAScatalog and LAS objects with rasterize_canopy (to rule out any issues with my LAScatalog chunks).

clip2_denoise.las

library(lidR)

las = readLAS("clip2_denoised.las")
mycsf <- csf(sloop_smooth=FALSE, cloth_resolution = 0.2, iterations = 500, class_threshold = 0.1)
gnd_las <- classify_ground(las, mycsf)
norm_las <- normalize_height(gnd_las, knnidw(k=10, p=2))

# this is ok in terra/raster - pulse spacing in clip is 0.03 m. In original file it's 0.02 m.
chm = rasterize_canopy(norm_las, res=0.09, p2r(0.2)) 

# recreate issue seen on original file which had pulse spacing 0.02 m with rasterize_canopy res=0.10
chm = rasterize_canopy(norm_las, res=0.06, p2r(0.2)) 
#>Error: [] lengths of of cells and values do not match

# change to raster
options(lidR.raster.default = "raster")
chm = rasterize_canopy(norm_las, res=0.06, p2r(0.2)) 
# No error with raster but output is incorrect.
plot(chm, col=height.colors(50))

Rplot

@Jean-Romain Jean-Romain added the Bug A bug in the package label Mar 22, 2022
@Jean-Romain Jean-Romain self-assigned this Mar 22, 2022
@Jean-Romain
Copy link
Collaborator Author

Fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in the package
Projects
None yet
Development

No branches or pull requests

1 participant