error in creating raster files for multiple tiles #678
Closed
taeyoonlee87
started this conversation in
General
Replies: 2 comments 2 replies
-
I need a minimal reproducible example |
Beta Was this translation helpful? Give feedback.
1 reply
-
The code is inccorect. I see an undefined variable las_cat<-readLAScatalog("E:/Lidar_2022/R/trials")
###Creat DTM
opt_output_files(las_cat) <- "E:/Lidar_2022/R/trials/trial_dtm/dtm_{XLEFT}_{YBOTTOM}"
dtm <- rasterize_terrain(las_cat, res = 1, algorithm = tin(), keep_lowest = FALSE)
##normalize - to substract ground elevation from each point / need las data and DTM
opt_output_files(las_cat) <-"E:/Lidar_2022/R/trials/trial_dtm/norm_{XLEFT}_{YBOTTOM}"
lasnorm <- normalize_height(las_cat, dtm)
f=function(X,Y, Z, Intensity, ReturnNumber,Classification) {
ans = stdmetrics(X,Y,Z,Intensity,ReturnNumber,Classification,dz=1, zmin=0)
ans = ans[c("zmean", "zsd", "pzabove2","zq5","zq15","zq35","zq40","zq45","zq95","zpcum6","zpcum7","isd","ipcumzq10",
"ipcumzq30","ipcumzq90","p1th","p2th")]
volume = -16.18216 + 0.1314547 * ans$zmean + 0.5586847 * ans$zsd + 0.05094551 * ans$pzabove2 - 0.8545914 * ans$zq5 - 3.435632 * ans$zq15 + 0.05012992 * ans$zq35 + 0.07849599 * ans$zq40 + 0.003158031 * ans$zq45 +5.12619*10^(-5) * ans$zq95 - 0.004623234 * ans$zpcum6 - 0.01141505 * ans$zpcum7 + 6.68966*10^(-5) * ans$isd + 0.03436324 * ans$ipcumzq10 + 0.02746617 * ans$ipcumzq30 + 0.2301962 * ans$ipcumzq90 - 0.06276224 * ans$p1th + 0.0969937 * ans$p2th
lambda = 0.3030303
return(list((lambda*volume+1)^(1/lambda)))
}
prediction <- pixel_metrics(lasnorm, ~f(X,Y, Z, Intensity, ReturnNumber,Classification), 5) |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, I am trying to create raster files and a map (images) after applying the regression model.
I define a function, f, including a regression model I would like to apply.
When I run my code with a single file, it runs without critical errors.
But when I ran it for multiple las files (in this case, I used two las files), it failed and indicated error messages.
Here is the part of the code that I encountered error.
and this is error message:
Or, I got this error either.
I changed the direction in
opt_output_files
and removedplot(prediction, col = height.colors(50))
but it did not helpful.Can you please advise how I create raster files?
Beta Was this translation helpful? Give feedback.
All reactions