Site icon R-bloggers

Lidar

[This article was first published on r.iresmi.net, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Aiguille du Midi – CC-BY-SA by Ivan Borisov

Day 1 of 30DayMapChallenge: « Points » (previously).

IGN is scanning France using LIDAR. More than half the country is available for downloading currently. Let’s play with points around the Aiguille du Midi

library(readr)
library(dplyr)
library(purrr)
library(fs)
library(lidR)

dir_create("tiles")

Selecting 4 squares on the selection map allows to generate a catalog of 1✕1 km tiles to download.

read_lines("liste_dalle.txt") |> 
  tibble(url = _) |> 
  mutate(file = path("tiles", path_file(url))) |> 
  pwalk(\(url, file) download.file(url, file))

Read and manipulate the LAZ files with the help of the {lidR} package. We only keep a region of interest 500 m around the peak.

ctg <- readLAScatalog("tiles")
roi <- clip_circle(ctg, x = 1001400, y = 6538400, radius = 500)

The point cloud has already been classified so we can extract only the ground (although at this altitude there is no vegetation).

ground <- filter_ground(roi)
plot(ground)

We display 38 millions points (50 points/m²)!

Aiguille du Midi in RGL

And then we can create a digital terrain model and a hillshade map…

dtm <- rasterize_terrain(roi, 2, tin(), pkg = "terra")
dtm_prod <- terra::terrain(dtm, v = c("slope", "aspect"), unit = "radians")
dtm_hillshade <- terra::shade(slope = dtm_prod$slope, aspect = dtm_prod$aspect)
plot(dtm_hillshade, col = gray(0:50/50), legend = FALSE)

DTM of Aiguille du Midi
< !-- -->
To leave a comment for the author, please follow the link and comment on their blog: r.iresmi.net.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Exit mobile version