I'm curious about how -thin_with_grid is actually performing thinning tasks within lidR.

Which point is selected? One point within the grid is randomly sampled? Is it possible to select for example the lowest?

I know there is a full list of filter parameters with lidR::readLAS(filter = "-help") but I think this part of documentation is relatively poor (e.g. clear info about input parameters or how to combine different filters)

1 Answer 1


The documentation is poor because the documentation of LAStools is poor. lidR relies on rlas which relies on LASlib to read LAS/LAZ files. LASlib is the library developed by and for LAStools. If you look at the documentation of LAStools you won't find anything more. Thereby rlas and consequently lidR cannot document more the filters.

The only way to know in depth what happens is to read the source code which is not trivial in the case of -thin_with_grid. And the answer is: it keeps the first point it encounters in the file for a given pixel.

And no, there is no way to keep the lowest or the highest. This is not part of the open source LASlib library. The close source part of LAStools have such tools but in lidR you must use decimate_points() to achieve such task.

I plan in the future to add something like -thin_highest_with_grid, -thin_lowest_with_grid but it is not for a close future.

  • Yes but decimate_points doesn't have a lowest algorithm. In my case, I have a very dense classified point clouds and I want to keep one (the lowest) ground by pixel before rasterizing
    – Adrien
    Mar 4, 2021 at 20:18
  • Ask a new question, I will show you how to create a custom function lowest() for decimate_points()
    – JRR
    Mar 4, 2021 at 20:19
  • 1
    FYI I added lowest() in lidR 3.1.2
    – JRR
    Mar 4, 2021 at 21:23
  • the question is here: gis.stackexchange.com/questions/389100/…
    – Adrien
    Mar 5, 2021 at 7:59

Your Answer

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

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