# How to deal with minus values on canopy height model?

I created a canopy height model (from lidar data) using lidR package and wanted to check it on Arcmap. I see there are minus values on canopy height models like -0.246219, -0.0302621. How can I deal with minus values in my canopy height model?

It is always advisable to filter your points prior to generating a canopy height model. The following is a processing pipeline that filters normalized points.

Pipeline Overview

2. Normalize point cloud so that ground = 0
3. Filter points, keeping points where Z >= 0m & Z <= 40m
4. Generate the canopy height model ``````library(lidR)

indata <- '/path/to/your/lidar_data.laz'

# Normalize point cloud data
normalized_las <- lasnormalize(las, tin())

# Keep points where Z >= 0 & Z <= 40
filtered <- lasfilter(normalized_las, Z >= 0 & Z <= 40)

# Visualize difference between filtered and unfiltered points
par(mfrow=c(2,2))
boxplot(normalized_las@data\$Z, ylim = c(-10,55), ylab = "Height (m)", main = "Before Filtering")
boxplot(filtered@data\$Z, ylim = c(-10,55), ylab = "Height (m)", main = "After Filtering")
hist(normalized_las@data\$Z, xlim=c(-2,55), xlab = "Height (m)", main = "Before Filtering")
hist(filtered@data\$Z, xlim=c(-2,55), xlab = "Height (m)", main = "After Filtering")

#Generate canopy height model
chm <- grid_canopy(filtered, 0.5, p2r(0.2))
plot(chm)
``````
• I do not necessarily agree with you. If you remove point below 2 you will have empty areas in your CHM for canopy gaps instead of zeros or values close to 0. Worst with a tin-based method you could fill the gap with irrelevant values. It can makes sense, or not depending on the method used and depending on what you want to do with your CHM.
– JRR
Dec 7 '19 at 22:39
• Thanks @JRR, I have edited the answer based on your comment.
– Aaron
Dec 7 '19 at 23:11
• Thanks a lot for your answers. I used the pit-free algorithm and used chm = grid_canopy(filtered, res=0.5, pitfree(c(0,2,5,10,15), c(0, 1.5))) at the final step. But I have too much triangles on my chm model now :( Dec 7 '19 at 23:22
• @bcresearcher Triangles?
– Aaron
Dec 7 '19 at 23:24
• @bcresearcher Open a new question with images and reproducible code.
– JRR
Dec 8 '19 at 0:21