How can I delete duplicate LiDAR points? I incorrectly read the same las twice and saved as a one file resulting in duplicate XY points. How should I delete these duplicate points?
You can delete all duplicate points from a las, laz or ascii file using
lasduplicate in LAStools.
Finds and removes all duplicate points from a LAS/LAZ/ASCII file. In the default mode those are xy-duplicate points that have identical x and y coordinates. The first point survives, all subsequent duplicates are removed. It is also possible to keep the lowest points amongst all xy-duplicates via ‘-lowest_z’.
It is also possible to remove only xyz-duplicates points that have all x, y and z coordinates identical via ‘-unique_xyz’.
lasfilterduplicates in the lidR package (documentation p. 51):
Filter points that appear more than once in the point cloud according to their X Y Z coordinates
If you consider to remove duplicated points on X, Y coordinates (with different Z), after using
lasfilterduplicates function from
lidR package, you may use
las <- lasfilter(las, !duplicated(las@data, by = c("X", "Y")))
I think it will retain the first return points (from that duplicated points).
You can also try a tool in WhiteboxTools - LidarRemoveDuplicates. You can run it separately through CMD line or as QGIS 3.4 plugin. Instruction on how to use and install WhiteboxTools in on their webpage
As an update on the answers by @wnursal and @Aaron :
lidR package function
lasfilterduplicates() is deprecated.
Instead, you can use the maintained version
filter_duplicates(). This can be applied to LAS files and LAS catalog objects.
When loading a catalog or a file, you can already set this within the function, and this maybe works also in your case:
# catalog ctg <- lidR::readLAScatalog("path/to/folder", filter = "-drop_overlap")
More options on filtering the initial data with
readLAS(filter = "-help"), not to be confused with later filtering based on Boolean criteria with