Skip to contents

This function processes all Canopy Height Model (CHM) TIFF files in a specified folder, detects tree tops using the detect_tops_in_CHM function, and optionally saves the results as a shapefile. Each tree top detection is assigned an ID number and the results are combined into a spatial dataframe.

Usage

tops_in_folder_to_shp(
  folder_path,
  ws_par,
  hmin_par,
  crs_def,
  output_folder,
  save_tops,
  save_SHP
)

Arguments

folder_path

The directory path containing the CHM TIFF files.

ws_par

The window size parameter for the local maxima filter (LMF) algorithm in the lidR package.

hmin_par

The minimum height parameter for the LMF algorithm.

crs_def

The coordinate reference system (CRS) definition to be applied to the output spatial dataframe.

output_folder

The directory path where the output shapefile should be saved if saving is enabled.

save_tops

A logical value indicating whether to save the detected tree tops data frame during processing.

save_SHP

A logical value indicating whether to save the final spatial dataframe as a shapefile.

Value

Returns a spatial dataframe of detected tree tops with ID numbers. If save_SHP is TRUE, a shapefile will also be generated.

Examples

if (FALSE) { # \dontrun{
tops_in_folder_to_shp("path/to/your/folder", 5, 2, 4326, "path/to/output/folder", TRUE, TRUE)
} # }