Learn R Programming

uavRst (version 0.5-2)

treepos_GWS: Find potential tree positions using a canopy height model

Description

Find potential tree positions using a canopy height model by using an iterative watershed algorithm. Basically returns a vector data sets with the tree crown geometries and a bunch of corresponding indices.

Usage

treepos_GWS(chm = NULL, minTreeAlt = 10, minTreeAltParam = "chmQ20",
  minCrownArea = 3, maxCrownArea = 150, join = 1, thresh = 0.1,
  split = TRUE, cores = parallel::detectCores(), giLinks = NULL)

Arguments

chm

raster* canopy height model

minTreeAlt

numeric. minimum height of trees to be integrated in the analysis

minTreeAltParam

character. code for the percentile that is used as tree height treshold. It is build using the key letters chmQ and adding the percentile i.e. "10". Default is chmQ20

minCrownArea

numeric. minimum area in square meter (if you use projected data) of the projected tree crowns

maxCrownArea

numeric. maximum area in square meter (if you use projected data) of the projected tree crowns

join

numeric. Join Segments based on Threshold Value, 0=no join, 1=treepos_GWS2saddle diff, 2=treepos_GWS2treepos diff. see also SAGA GIS Help

thresh

numeric. Specify a threshold value as minimum difference between neighboured segments in meter. see also SAGA GIS Help

split

split polygons default is TRUE

cores

number of cores to be used

giLinks

list. of GI tools cli paths

Examples

Run this code
# NOT RUN {
# required packages
require(uavRst)
require(link2GI)

# create and check the links to the GI software
giLinks<-uavRst::linkAll()
if (giLinks$saga$exist & giLinks$otb$exist & giLinks$grass$exist) {

# project folder
projRootDir<-tempdir()

# create subfolders please mind that the pathes are exported as global variables
paths<-link2GI::initProj(projRootDir = projRootDir,
                         projFolders = c("data/","data/ref/","output/","run/","las/"),
                         global = TRUE,
                         path_prefix = "path_")

 data(chm_seg)

# calculate treepos using uavRst generic approach
 tPos <- uavRst::treepos_GWS(chm = chm_seg[[1]],
                         minTreeAlt = 2,
                         maxCrownArea = 150,
                         join = 1,
                         thresh = 0.35,
                         split=TRUE,
                         cores=1,
                         giLinks = giLinks )
}
##+
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab