2

Why do lidR and LAStools report different point densities?

For a .las that I have here. Both report number of points correctly at 12500 pts.

The CRS is set and both also report it correctly.

But for point density:

  • lidR 293.92 points/m²
  • LAStools 209.05 points/m²

Why and which one is correct?

As requested, here's a picture of the cloud.

enter image description here

4
  • Please show a plot of your point cloud
    – JRR
    Commented Nov 15, 2021 at 18:27
  • @JRR Can you explain why?
    – mavavilj
    Commented Nov 15, 2021 at 18:29
  • To give you a valid and detailed answer. Otherwise I'll have to make guesses on the shape of the point-cloud
    – JRR
    Commented Nov 15, 2021 at 18:30
  • @JRR This picture is fine?
    – mavavilj
    Commented Nov 15, 2021 at 18:45

1 Answer 1

2

Your point cloud is likely to have a shape that is complex and not square, rectangular or convex (hard to say in your image). Below a point-cloud of mine seen from above.

screenshot

I don't know how lastools estimate the density (we must dig in the source code to know) but in all case it is an estimate and many results are valid depending on how you compute the area covered by the point cloud.

In the above point-cloud we can estimate the density with:

  1. The number of points divided by the area of the bounding box. This is inaccurate if the point cloud is not rectangular
    density(las@header)
    #> [1] 1.74
    
  2. To be more accurate lidR computes the convex hull of the point cloud and uses the area of this polygon as denumerator.
    density(las)
    #> [1] 2.71
    
  3. To be more accurate we can use a concave hull. lidR does not do that by default because it is computationally demanding but I can do it with internal tools. In this case I get 3.21
  4. We can also use a raster-based approach by rasterizing the density and computing the average
    d = grid_density(las)
    mean(d[d>0])
    #> [1] 3.13
    
  5. With lastools, for my point-cloud I get 3.18.

The points 3,4 and 5 are relatively close so we can suppose that the method in lastools is somehow based on the computation of complex hulls or on a raster-based method.


Edit based on lasinfo source code I was able to reproduce lastools output with lidR

d = grid_density(las, 2)
> mean(d[d>0])
[1] 3.18

Which is a solution that does not work for low density point cloud or longlat point-clouds

14
  • 1
    lasinfo mylas.las -compute_density.
    – mavavilj
    Commented Nov 15, 2021 at 18:50
  • Also, density(tls@header) gives 227.2283, which is not the same as what lasinfo gives. Though closer to it.
    – mavavilj
    Commented Nov 15, 2021 at 18:51
  • Thank you for your answer. I'm not aware, how these differences will translate to practical computations, but there are some domains where point density is a critical parameter and thus such large differences should be non-tolerable. OTOH it may seem that matching what LAStools produces might be thought as the "grand references", since LAStools is quite broadly used(?)
    – mavavilj
    Commented Nov 15, 2021 at 19:13
  • Based on github.com/LAStools/LAStools/blob/… lastools clearly uses a grid-based approach
    – JRR
    Commented Nov 15, 2021 at 19:16
  • See my edit, after digging in lastools source code
    – JRR
    Commented Nov 15, 2021 at 19:19

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.