SHARE
TWEET

Untitled

a guest Aug 19th, 2019 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. metrics<-function(z){Q75=quantile(z,probs=c(0.75))        
  2.  
  3. aboveq75=sum(z>Q75)
  4.  
  5. dh75=aboveq75/length(z)
  6.  
  7. return(dh75)}
  8.  
  9. DH75<-grid_metrics(lid,~metrics(Z),res = 30)
  10.      
  11. #dependencies
  12. library(lidR)
  13. library(ggplot2)
  14. library(stats)
  15.  
  16. #specify file path
  17. infile <- 'path_to_your_cloud.las'
  18.  
  19. #read in las cloud
  20. las <- readLAS(infile)
  21.  
  22. #create density raster
  23. density_plot <- grid_density(las, res = 10)
  24.  
  25. #calculate 75th percentile point density
  26. Q75 = quantile(density_plot$point_density, probs = 0.75)
  27.  
  28. #filter raster based on value
  29. density_plot_Q75 <- density_plot[density_plot$point_density > Q75]
  30.  
  31. #plot unfiltered raster
  32. ggplot() +
  33.   geom_raster(data = density_plot , aes(x = X, y = Y, fill = point_density)) +
  34.   coord_quickmap()
  35.  
  36. #plot filtered raster
  37. ggplot() +
  38.   geom_raster(data = density_plot_Q75 , aes(x = X, y = Y, fill = point_density)) +
  39.   coord_quickmap()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top