I have a las file where I have (In total 120) 100 unclassified (class 0) points and 20 building (class 6 points) which has all the attributes (x,y,z,intensity,scan_angle,etc) same as 20 unclassified points in the las file.
In summary, I have:
80 unclassified (unique points)
Duplicate/Overlapping points (same X,Y,Z,…..) – 20 points in class 0 and 20 points in class 6.
I need 80 unclassified (class 0) points and 20 building (class 6) points in one las file by removing 20 unclassified (class 0) points.
I need a workflow/function that can I use from laspy, lidR, pdal, Lastools or any other tool to get 80 unclassified (class 0) points and 20 building (class 6) points in one las file.
I tried lasduplicate in lastools and filter_duplicate in lidR. However, both are removing the 20 building (class 6) points instead of removing 20 unclassified (class 0) points.
Copy the code of lidR::filter_duplicated()
and use fromLast
dup_xyz <- duplicated(las@data, by = c("X", "Y", "Z"), fromLast=TRUE)
las = las[!dup_xyz]