spectral_indices_for_crowns: Calculate Spectral Indices For Individual Tree Crowns

Description Usage Arguments Value

View source: R/spectral_indices_for_crowns.r

Description

Calculate one or more spectral indices for individual tree crowns depicted in a polygon shapefile and a provided raster image and write the output optionally to a .shp

Usage

1
2
3
spectral_indices_for_crowns(crown_SpatPoldf, r_fname, index_names = NULL,
  bandnames = NULL, all_bands = T, extract_as_points = F,
  shp_outname = NULL)

Arguments

crown_SpatPoldf

SpatialPolygonsDataFrame depicting crowns

r_fname

Raster file of the image to calculate the spectral index from. The bands of the raster should be named following the Quantalab convention *X700.000000.Nanometers*

index_names

Character vector with the names of a spectral indices implemented as a function in CanHeMonR. e.g. "G_over_B". If left to NULL (the default) and all_bands is T, then only the average band values, and no indices are returned. This is useful when extracting values from a DEM image for example.

bandnames

Character. In case the bands aren't named according to wavelength and following csic convention, they can be provided. Default is NULL in which cases bandnames are read from the image file and csic naming convention is assumed.

all_bands

Logical. Should individual band values be returned? Default = T

extract_as_points

Logical. Should the SpatialPolygons be converted to SpatialPoints before extracting pixel values? This can be useful and save lots of time when the polygons are smaller than the cel size of the image. Default is FALSE.

shp_outname

Filename for a shapefile of the output. If NULL, no output file is written away. Default is NULL.

Value

A point shapefile with attribute table, and the points placed at the centroid of each crown. The attribute table of the shp file maintains the attribute table of the crown but adds a column for each spectral index.


pieterbeck/CanHeMonR documentation built on May 25, 2019, 7:11 a.m.