lidR icon indicating copy to clipboard operation
lidR copied to clipboard

Unexpected behaviour classify_roi()

Open zoeschindler opened this issue 7 months ago • 3 comments

Hello, I have an issue with classify_roi(). I want to classify points within some polygons (derived from buffered lines) as a different class than the remaining points. But when I read my data in using readTLSLAS() instead of readLAS(), I get weird results. I made some dummy data: https://drive.google.com/file/d/1OOl4_vRYCIRSmx-Ey7cflgZv_s-y9l07/view?usp=sharing

Here is the code:

# load packages
library(lidR)
library(sf)

# read pointcloud
las <- readTLSLAS("test.las")
crs(las) <- "EPSG:32632"

# load shapes
shp_lines <- st_read("test.shp")
shp_polys <- st_buffer(shp_lines, 0.025)

# show pointcloud & shapes
plot(las)
plot(shp_polys)

# classify using lines
las$Classification <- LASUNCLASSIFIED
las <- classify_poi(las, class = LASGROUND, roi = shp_polys)

# show results
plot(las, color = "Classification")
plot(filter_poi(las, Classification == LASGROUND))

Polygons: grafik

Result when using readLAS() (expected result): grafik

Result when using readTLSLAS() (unexpected result): grafik

zoeschindler avatar Nov 21 '23 20:11 zoeschindler