Loading and Preparing Data

Importing and preparing the LiDAR data for further analysis.

#reading in data
las2017 <- readLAS("data/Lidar2017.las")
## Warning: There are 3394647 points flagged 'withheld'.
las2014 <- readLAS("data/Lidar2014.las")

Filtering for last returns

# filtering for last returns, removing extreme Z values
ret2017 <- filter_poi(las2017, ReturnNumber == NumberOfReturns & Z > -200 & Z < 250)
plot(ret2017, size = 4, bg="white")
## Warning in par3d(userMatrix = structure(c(1, 0, 0, 0, 0, 0.342020143325668, :
## font family "sans" not found, using "bitmap"
#for quick visualizations (helped me see where extremes were)
# viz2017 <- decimate_points(ret2017, homogenize(1))
# plot(viz2017, size = 4, bg = 'white')

Transforming to Raster

Transforming into raster. While the function here is officially used for the creation of DTMs, since I have already filtered for last returns, it should only create a DEM.

#transforming to raster (this is commented due to the longgggg time it took to create the DEM, and would take too long to upload to RPubs at this exact moment)
# dem2017 <- rasterize_terrain(ret2017, 1, knnidw())

Separating the visualizations so I can run them on their own

#top down raster view
# plot(dem2017, col = gray(1:50/50))

#3D view (didnt work super well lol, crashed my laptop)
# plot_dtm3d(dem2017, bg='white')

(TEST - OLD AND DIDNT WORK) Normalizing Point Cloud and Creating DEM:

Creating the DEMs for analysis

#normalizing point cloud
# nlas2017 <- las2017 - dtm2017
# plot(nlas2017, size = 4, bg = "white")
#lots of outstanding points? Negative values?

#checking ground points
# gnd2017 <- filter_ground(las2017)
# plot(gnd2017, size = 3, bg = "white", color = 'Classification')

(TEST) DSM test

# dsm2017 <- grid_canopy()