Closed Rpouliot closed 2 years ago
When using the manual correction on an automatic tree detection, the CRS results in NA. The tree segmentation then results in error.
LASfile <- system.file("extdata", "MixedConifer.laz", package="lidR") las <- readLAS(LASfile, select = "xyzr", filter = "-drop_z_below 0") chm <- rasterize_canopy(las, 0.5, pitfree(subcircle = 0.2)) ttops <- locate_trees(las, lmf(ws = 5)) manual_ttops <- locate_trees(las, manual(ttops)) algo <- dalponte2016(chm, manual_ttops) seg_las <- segment_trees(las, algo) #> Error in geos_op2_geom("intersection", x, y, ...) : #> st_crs(x) == st_crs(y) n'est pas TRUE
st_crs(manual_ttops) #> Coordinate Reference System: NA st_crs(ttops) #> Coordinate Reference System: #> User input: EPSG:26912
To work around this error, we can assign the st_crs(manual_ttops) <- st_crs(ttops). Then, these lines and the tree segmentation works fine:
st_crs(manual_ttops) <- st_crs(ttops)
algo <- dalponte2016(chm, manual_ttops) seg_las <- segment_trees(las, algo)
When using the manual correction on an automatic tree detection, the CRS results in NA. The tree segmentation then results in error.
To work around this error, we can assign the
st_crs(manual_ttops) <- st_crs(ttops)
. Then, these lines and the tree segmentation works fine: