Download presentation
Presentation is loading. Please wait.
1
lasR Etc. Jacob Strunk April 11, 2017
2
Why NOT Lidar In R? Slow Inefficient (memory footprint etc.)
Annoying / casual syntax Weird OOP support (3+ versions) Python, Java, C# have more capabilities You WILL run into barriers if you use it long enough You will likely come to hate (and love) R
3
Why Lidar In R? Great for exploratory analyses Easy, fun Lots of users
Large user support community – e.g. help forums Simple to append to language Lots of support for statistics Simple programming paradigm (high level) Easy to do research and visualization
4
Presentation 2 Sections R, Rstudio, Git, GitHub toolchain
lidR and lasR – working with lidar in R
5
R Packages “… the fundamental unit of shareable code is the package. A package bundles together code, data, documentation, and tests, and is easy to share with others.”
6
Why build packages? Portable Testable Extensible
Facilitates collaboration Reduces redundancy Encourages more work in your topic of interest People are freed up to do other cool things (and hopefully create packages) Once you start (using RStudio) you will never go back…
7
Functional programming
R packages very suited to functional programming: hello <- function() { print("Hello, world!") } Some of us may be more used to this style: … #print hello world
8
R Packages Rstudio – So easy Not in Rstudio – tedious
Rstudio has a really convenient toolchain that eliminates most of the frustration of package building
9
Rstudio, Very Convenient IDE for R
Package build / test support R syntax highlighting, suggesting and code execution ROxygen syntax highlighting, suggesting R Manual Page previewing RCPP support Git support RShiny support …
10
Step 1 Get / install all of the tools – default settings are fine R
Rtools Rstudio Miktex GIT Sign up for GIT account
11
Build an R package 4 1 2 3
12
Build Package New package pre-populated with example function – just build it
13
Git
14
Git commit (first time)
Shift-click to select all items commit
15
Git commit (add function)
Shift-click to select all items commit
16
Git Push (to GitHub) Will need to log in first time
17
Git History Awesome See old versions of scripts before you screwed them up…
18
Git branch history Experiment Merge in experiment
19
Roxygen maintain one set of code
No need to manage help files separately from code…
20
Roxygen: Auto-populate Help Files (Awesome)
Just paste template into header of code and the appropriate files are auto-created
21
lidR and lasR Working with lidar in R
22
LidR Read/write las/laz files Read in a dem files
Process point data -> raster Process point data -> sample plots Visualize data … other stuff Iterate across files in a project
23
lidR limitations Cannot tile on the fly – lidar data become processing tiles Assumes footprints of DEM and LIDAR are the same Cannot easily call external .exe file
24
lidR Lots of functionality A few serious limitations
25
lidR::plot() plot(dat1,bg="white")
26
lidR::lasground() > lasground(dat1,CellSize = 6,MaxDist = 9,InitDist = 0.1) > plot(dat1, color = "Classification",bg="white")
27
lidR::lasground() Slow, but seems to work fine
28
lidR::lasground() – Stereo DSM points
29
lidR::catalog & lidR::catalog_apply
ct1=catalog(getwd()) f1=function(x){require(lidR);grid_metrics(readLAS(x), .stdmetrics)} res1=catalog_apply(ct1,f1, mc.cores = 7, combine = "rbind", varlist = "ct1")
30
lasR Very beta Very little functionality Re-tile on the fly!!
Work with fusion exes
31
lasR
32
lasR Read in las data Read in DEM files
Tile lidar project area on the fly Create lidar processing project Iterate across processing tiles (not lidar files) Clip plot from lidar processing project
33
lasR::scan_dtm Bounding boxes…
34
lasR::scan_las NAIP 2015 DSM tiles
35
lasR::lasR_project Create processing tiles Subset area
Intersect with lidar files Intersect with dtm files Subset area
36
lasR::gridmetrics Create custom metrics in R
Send files to FUSION using system calls
37
lasR::forthcoming Clip plots using projects (deals with edges)
Metrics for plots Other lidar & inventory steps
38
Thank you
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.