R/rs_pc_2D_dsm.R
pc_2D_dsm.Rd
Create a Digital Surface Model from a high density point cloud as typically derived by an optical UAV retrieval. It simply samples the maximum or whatever values of a given target grid size and fills the no data holes if so.
pc_2D_dsm(
laspcFile = NULL,
gisdbasePath = NULL,
grassVersion = 1,
searchPath = NULL,
sampleMethod = "max",
threshold = 20,
cutExtent = NULL,
targetGridSize = 0.25,
projFolder = NULL,
proj4 = "+proj=utm +zone=32 +datum=WGS84 +units=m +no_defs",
giLinks = NULL,
verbose = FALSE
)
character. default is NULL
path to the laz/las file(s)
character. default is NULL
root directory of the project. NOTE the function creates two subfolder named run
and output
numeric. version of GRASS as derived by findGRASS() default is 1 (=oldest/only version) please note GRASS version later than 7.4 is not working with r.inlidar
path to look for grass
sampling method for point aggregation
numeric. percentile threshold
clip area
numeric. the resolution of the target DTM raster
subfolders that will be created/linked for R related GRASS processing
character. valid proj4 string that should be assumingly the correct one
list of link2GI cli pathes, default is NULL
to be quiet (1)
raster* object
if (FALSE) {
require(uavRst)
require(link2GI)
# create and check the links to the GI software
giLinks<-list()
giLinks$grass<-link2GI::linkGRASS7(returnPaths = TRUE)
if (giLinks$grass$exist) {
# proj subfolders
projRootDir<-tempdir()
unlink(paste0(projRootDir,"*"), force = TRUE)
paths<-link2GI::initProj(projRootDir = projRootDir,
projFolders = c("data/","data/ref/","output/","run/","las/"),
global = TRUE,
path_prefix = "path_")
# get some colors
pal = mapview::mapviewPalette("mapviewTopoColors")
# get the data
utils::download.file(url="https://github.com/gisma/gismaData/raw/master/uavRst/data/lidar.las",
destfile="lasdata.las")
# create 2D pointcloud DSM
dsm <- pc_2D_dsm(laspcFile = "lasdata.las",
gisdbasePath = projRootDir,
sampleMethod = "max",
targetGridSize = 0.5,
giLinks = giLinks)
}
raster::plot(dsm)
}