From b0103f34633beaa9618c0a71246586706fd8a2ef Mon Sep 17 00:00:00 2001 From: markusmnzinger Date: Thu, 2 Mar 2023 14:12:40 +0100 Subject: [PATCH] output paths update --- ...fication-and-individual-crown-parameterization.Rmd | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/R/urban-forest-classification-and-individual-crown-parameterization.Rmd b/src/R/urban-forest-classification-and-individual-crown-parameterization.Rmd index 251169e..8cbdd38 100644 --- a/src/R/urban-forest-classification-and-individual-crown-parameterization.Rmd +++ b/src/R/urban-forest-classification-and-individual-crown-parameterization.Rmd @@ -26,7 +26,8 @@ if (!requireNamespace("imager", quietly = TRUE)) install.packages("imager") if (!require("BiocManager", quietly = TRUE)) install.packages("BiocManager") -BiocManager::install("EBImage") +if (!require("EBImage", quietly = TRUE)) + BiocManager::install("EBImage") if (!requireNamespace("terra", quietly = TRUE)) install.packages("terra") if (!requireNamespace("ForestTools", quietly = TRUE)) @@ -285,7 +286,7 @@ ws_segments_cleaned <- terra::subset(ws_segments_cleaned, ws_segments_cleaned$t ndsm_grid <- terra::mask(ndsm_grid, ws_segments_cleaned, inverse=FALSE, updatevalue=NA, touches=FALSE) # store as raster GeoTIFF -ndsm_grid_out_path <- here::here("results/urban_forest_classification", paste0("chm_grid.tif")) +ndsm_grid_out_path <- here::here("results/urban_forest_classification", "chm_grid.tif") terra::writeRaster(ndsm_grid, ndsm_grid_out_path, overwrite = TRUE) # merge CHM to point cloud @@ -295,7 +296,7 @@ lidar_surface_points <- lidR::merge_spatial(lidar_surface_points, ndsm_grid, att lidar_surface_points <- lidR::filter_poi(lidar_surface_points, !is.na(CHM)) # store LiDAR point cloud as LAS -lidar_chm_points_out_path <- here::here("results/urban_forest_classification", "lidar_chm_points.las")) +lidar_chm_points_out_path <- here::here("results/urban_forest_classification", "lidar_chm_points.las") lidR::writeLAS(lidar_surface_points, lidar_chm_points_out_path) # delete intermediate data @@ -478,11 +479,11 @@ tree_positions_point <- terra::merge(tree_positions_point, tree_attribs_df, by = crowns_convex_hull_poly <- terra::merge(crowns_convex_hull_poly, tree_attribs_df, by = "treeID") # store tree positions as geojson -tree_positions_out_path <- here::here("results/parameterized_tree_crowns",paste0("tree_positions_parameterized.geojson")) +tree_positions_out_path <- here::here("results/parameterized_tree_crowns", "tree_positions_parameterized.geojson") terra::writeVector(tree_positions_point, tree_positions_out_path, filetype = "GeoJSON", overwrite = TRUE) # store tree crowns as geojson -crowns_convex_hull_parameterized_out_path <- here::here("results/parameterized_tree_crowns",paste0("crowns_convex_hull_parameterized.geojson")) +crowns_convex_hull_parameterized_out_path <- here::here("results/parameterized_tree_crowns", "crowns_convex_hull_parameterized.geojson") terra::writeVector(crowns_convex_hull_poly, crowns_convex_hull_parameterized_out_path, filetype = "GeoJSON", overwrite = TRUE) ```