2

I am using the great lidR package and want to check all points classified as ground which are not the last returns.

How would I do that?

Something like this would this would be logic for me but its not working:

ground <- filter_ground(las)

ground_nolast <- !filter_last(ground)
ground_nolast <- filter_poi(ground, ReturnNumber != -1L)

1 Answer 1

2

The definition of "last" is ambiguous. The last returns include (1) the last in a sequence of many and (2) the first in a sequence of one. If you want to remove (1) + (2)

ground_nolast <- filter_poi(ground, ReturnNumber != NumberOfReturn)

But you won't have a lot of point I guess because it removes all first returns. If you want only (1)

ground_nolast <- filter_poi(ground, ReturnNumber != NumberOfReturns | NumberOfReturns == 1L)

Of course for this to work ReturnNumber and NumberOfReturns must be properly populated and you should check your data with las_check() first.

1
  • Thanks for your ultra fast response! This is exactly what I was looking for. Nov 2, 2021 at 9:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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