4

The lidR package in R provides a way to mark individual points in a point cloud with a flightline ID by using lasflightline(). From the documentation:

Retrieve each individual flightline by attributing a number to each point. The function depends on the GPS time to retrieve each individual flightline. In a continuous dataset, once points are ordered by GPS time, the time between two consecutive points does not exceed a few milliseconds. If the time between two consecutive points is too long it means that the second point is from a different flightline. The default threshold is 30 seconds. A column 'flightlineID' is added in the slot @data

How can one filter the resulting point cloud by the flightline ID so that overlapping points from different flightlines are removed from the filtered product? Essentially, I am looking to remove the overlapping points so as to produce a homogeneous point cloud with no scanline overlaps.

5

This is not natively possible yet in lidR! But R is a programming language so you can write your own algorithm to achieve this task. If you can do that please share with the community it could be useful ;-). I think LAStools has such tool.

2

Update:

Essentially, I am looking to remove the overlapping points so as to produce a homogeneous point cloud with no scanline overlaps.

Besides thinning (Thinning large LiDAR point cloud?), if the .las file is classified (or flagged) as 'overlapping' points one can filter those out on-the-fly while importing data in R.

  • For versions LAS 1.0 to 1.3 (point formats 0 to 5) overlapping points have their own class code, usually class 12. They can be filtered out with -drop_class 12 as reported in your answer here.

  • For version LAS 1.4 (point formats 6 to 10), it was introduced a group of classification flags, being one of them Overlap. This flag allows points to be flagged 'overlap' while also labeled with a different class code. For example, it can be an overlapping point (flagged) and a ground point (class 2). For those types of files, do the following*:

library(lidR) 
file.path <- system.file("extdata", "Megaplot.laz", package="lidR")
lidar <- readLAS(file.path, filter = "-drop_overlap") #LAS 1.4 (point formats 6 to 10) which has overlapping points set to 1 in the Classification Flag 'Overlap'.

*It is said in lidR 2.0 documentation that readLAS has partial support for LAS version 1.4. I did not test this yet, but theoretically it should work.

Other methods and software for removing overlapping points are reported in Open source approach to classifying and removing LiDAR points from overlapping scans?


Original answer:

How to filter point cloud by flightline in R?

As pointed by JRR's answer, it is not possible yet using native filters from readLAS function available in the lidR package (see rlas:::lasfilterusage()).

So, the current alternative is to use lasfilter. See below:

library(lidR) 
file.path <- system.file("extdata", "Megaplot.laz", package="lidR")
lidar <- readLAS(file.path)
lasflightline(lidar, dt = 30)
#check how many flight lines (there should be at least two, so this exercise makes sense)
unique(lidar@data$flightlineID)

for (i in c(1:2)){
assign(paste("lidar.flightline.",i,sep=""), lasfilter(lidar, flightlineID == i))
}

rm(file.path,i,lidar)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.