poly_stat: Calculate descriptive statistics of raster as segmented by...

View source: R/tb_bluedjinn.R

poly_statR Documentation

Calculate descriptive statistics of raster as segmented by polygons

Description

calculate statitiscs of polygon based raster extraction. Returns a spatialpolygon dataframe containing decriptive statistics

Usage

poly_stat(
  rasternames = NULL,
  spdf = NULL,
  count = 1,
  min = 1,
  max = 1,
  sum = 1,
  range = 1,
  mean = 1,
  var = 1,
  stddev = 1,
  quantile = 10,
  parallel = 1,
  proj = "+proj=utm +zone=30 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs",
  path_run = tempdir(),
  giLinks = NULL
)

Arguments

rasternames

vector of raster* objects default is NULL

spdf

spatial polygon dataframe default is NULL

count

0 1 switch

min

0 1 switch

max

0 1 switch

sum

0 1 switch

range

0 1 switch

mean

0 1 switch

var

0 1 switch

stddev

0 1 switch

quantile

number of quantile

parallel

run it parallel default is 1

proj

projection string

path_run

run time folder for all kind of calculations, by default tempdir()

giLinks

list of GI tools cli pathes, default is NULL

Value

data frame containing the descriptive statistic of all corresponding raster* objects for each given polygon

Author(s)

Chris Reudenbach

Examples

## Not run: 
# required packages
require(uavRst)
require(link2GI)

# create and check the links to the GI software
giLinks<-uavRst::linkGI(linkItems = c("saga","gdal"))
if (giLinks$saga$exist) {

# get the rgb image, chm and training data
url <- "https://github.com/gisma/gismaData/raw/master/uavRst/data/tutorial_data.zip"
utils::download.file(url, file.path(tempdir(),"tutorial_data.zip"))
unzip(zipfile = file.path(tempdir(),"tutorial_data.zip"), exdir = tempdir())

polyStat <- poly_stat("chm_3-3_train1",
                      spdf = "rgb_3-3_train1.shp",
                      giLinks=giLinks)
                      
raster::plot(polyStat)
}
##+
## End(Not run)


gisma/uavRst documentation built on Feb. 14, 2023, 8:49 a.m.