Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- metrics<-function(z){Q75=quantile(z,probs=c(0.75))
- aboveq75=sum(z>Q75)
- dh75=aboveq75/length(z)
- return(dh75)}
- DH75<-grid_metrics(lid,~metrics(Z),res = 30)
- #dependencies
- library(lidR)
- library(ggplot2)
- library(stats)
- #specify file path
- infile <- 'path_to_your_cloud.las'
- #read in las cloud
- las <- readLAS(infile)
- #create density raster
- density_plot <- grid_density(las, res = 10)
- #calculate 75th percentile point density
- Q75 = quantile(density_plot$point_density, probs = 0.75)
- #filter raster based on value
- density_plot_Q75 <- density_plot[density_plot$point_density > Q75]
- #plot unfiltered raster
- ggplot() +
- geom_raster(data = density_plot , aes(x = X, y = Y, fill = point_density)) +
- coord_quickmap()
- #plot filtered raster
- ggplot() +
- geom_raster(data = density_plot_Q75 , aes(x = X, y = Y, fill = point_density)) +
- coord_quickmap()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement