When using segment_trees with any of the methods the function throws out and error:
Error in st_crs.character(terra::crs(.x)) : invalid crs:
The error started appearing after update of lidR to version 4.0.2, previously there were no issues with segmentation. I tested the code with different point clouds but I keep getting the same error.
# Load the normalized LAS file
las = readLAS("ALS_2017_plot_normZ_fltr.las", filter = "-drop_z_below 0")
#Create Canopy Height Model
#chm <- rasterize_canopy(las, res = 1, algorithm = p2r())
chm <- rasterize_canopy(las, res = 0.5, pitfree(max_edge = c(0, 2.5)))
# Plot the canopy height model
col <- height.colors(25)
plot(chm, col = col)
#Detect the tree tops
ttops <- locate_trees(chm, lmf(ws = 1, hmin = 5))
#Plot the tree tops
plot(chm, col = height.colors(50))
plot(sf::st_geometry(ttops), add = TRUE, pch = 3)
# Segmentation
las <- segment_trees(las, silva2016(chm, ttops))
[ALS_2017_plot_normZ_fltr.zip](https://github.com/r-lidar/lidR/files/9631838/ALS_2017_plot_normZ_fltr.zip)
When using segment_trees with any of the methods the function throws out and error:
Error in st_crs.character(terra::crs(.x)) : invalid crs:
The error started appearing after update of lidR to version 4.0.2, previously there were no issues with segmentation. I tested the code with different point clouds but I keep getting the same error.