Can you count point density with lastools?

1,621 views
Skip to first unread message

Nicholas Pilkington

unread,
Dec 12, 2017, 8:26:10 PM12/12/17
to LAStools - efficient tools for LiDAR processing
I'm interested in the average number of points per meter^3 in my LAS file so that I can select a value for thin_with_grid and know approximately how many points will remain?

Is this possible?

Martin Isenburg

unread,
Dec 13, 2017, 2:53:08 AM12/13/17
to LAStools - efficient command line tools for LIDAR processing
Hello Nick,

I assume you mean the average number of points per square meter. The tool that can do this is lasinfo with option '-cd'  but also lasgrid with the option '-point_density_16bit' and some grid step size such as '-step 2'. 


Here an example using the data set you posted in this thread:


The easiest is simply running lasinfo with the '-cd' option:

E:\LAStools\bin>lasinfo -i points.laz -nh -nv -nr -nmm -cd
lasinfo (171124) report for points.laz
covered area in square units/kilounits: 44328/0.04
point density: all returns 29.93 last only 29.93 (per square units)
      spacing: all returns 0.18 last only 0.18 (in units)

And that shows us that the average spacing across the entire file is 29.93 returns per square meter. But we can also use lasgrid to create a raster that computes the density for every 2 by 2 meter cell and then output a histogram of the resulting raster entries with lasinfo to get a better idea of how the 

E:\LAStools\bin>lasgrid -i points.laz -point_density_16bit -step 2 -odix _density_2m -obil

E:\LAStools\bin>lasinfo -i points_density_2m.bil -nh -nv -nr -nmm -histo z 4
lasinfo (171124) report for points_density_2m.bil
WARNING: there is coordinate resolution fluff (x10) in XY
WARNING: there is serious coordinate resolution fluff (x100) in XY
WARNING: for return 1 real number of points by return is 11082 but header entry was not set.
z coordinate histogram with bin size 4
  bin [0,4) has 59
  bin [4,8) has 58
  bin [8,12) has 65
  bin [12,16) has 54
  bin [16,20) has 51
  bin [20,24) has 387
  bin [24,28) has 4263
  bin [28,32) has 3341
  bin [32,36) has 1325
  bin [36,40) has 636
  bin [40,44) has 495
  bin [44,48) has 145
  bin [48,52) has 37
  bin [52,56) has 27
  bin [56,60) has 22
  bin [60,64) has 17
  bin [64,68) has 15
  bin [68,72) has 6
  bin [72,76) has 12
  bin [76,80) has 4
  bin [80,84) has 4
  bin [84,88) has 5
  bin [88,92) has 7
  bin [92,96) has 3
  bin [96,100) has 4
  bin [100,104) has 5
  bin [104,108) has 2
  bin [108,112) has 3
  bin [112,116) has 6
  bin [116,120) has 6
  bin [120,124) has 2
  bin [124,128) has 4
  bin [128,132) has 4
  bin [132,136) has 3
  bin [136,140) has 1
  bin [140,144) has 1
  bin [144,148) has 1
  bin [148,152) has 1
  bin [160,164) has 1
  average z coordinate 29.93178126691933 for 11082 element(s)

You can also output a false coloring of the density distribution to get a quick overview how uniform the density is and where the extremely high / low density areas are using a sommand similar to the one shown below. The result is attached.

E:\LAStools\bin>lasgrid -i points.laz -point_density_16bit -step 2 -false -set_min_max 20 40 -odix _density_2m_20_40 -opng

Regards,

Martin @rapidlasso
points_density_2m_20_40.png
points_density_2m_20_40.kml

Nicholas Pilkington

unread,
Dec 13, 2017, 3:31:15 PM12/13/17
to LAStools - efficient tools for LiDAR processing
Is "spacing" the average distance (in 2D) between pairs of points?

Martin Isenburg

unread,
Dec 13, 2017, 4:34:47 PM12/13/17
to LAStools - efficient command line tools for LIDAR processing
Hello Nick,

yes. The computation of those in lasinfo is as follows:

last_return_density = total_number_last_returns/approx_total_area_in_square_meter
last_return_spacing = sqrt(approx_total_area_in_square_meter/total_number_last_returns)
or
last_return_spacing = sqrt(1/last_return_density)

For more on density and spacing of (LiDAR) point clouds and how different scanner patterns lead to different spacing distributions read this blog article here:

https://rapidlasso.com/2014/03/20/density-and-spacing-of-lidar/

For your dense-matching points you can get a more accurate histogram of the (not applicable here but still last return) spacing by computing a last return TIN and then measure the distribution of edge length in xy with this command here:

E:\LAStools\bin>las2tin -i points.laz -keep_last -histo_only edge_length 0.1
edge length histogram histogram with bin size 0.1
  bin [0.0,0.1) has 240817
  bin [0.1,0.2) has 1197411
  bin [0.2,0.3) has 2282599
  bin [0.3,0.4) has 208002
  bin [0.4,0.5) has 13213
  bin [0.5,0.6) has 601
  bin [0.6,0.7) has 523
  bin [0.7,0.8) has 223
  bin [0.8,0.9) has 247
  bin [0.9,1.0) has 123
  bin [1.0,1.1) has 157
  bin [1.1,1.2) has 97
  bin [1.2,1.3) has 96
  bin [1.3,1.4) has 74
  bin [1.4,1.5) has 96
  bin [1.5,1.6) has 71
  bin [1.6,1.7) has 78
  bin [1.7,1.8) has 48
  bin [1.8,1.9) has 73
  bin [1.9,2.0) has 35
  bin [2.0,2.1) has 40
  bin [2.1,2.2) has 56
  bin [2.2,2.3) has 32
  bin [2.3,2.4) has 30
  bin [2.4,2.5) has 21
  bin [2.5,2.6) has 23
  bin [2.6,2.7) has 18
  bin [2.7,2.8) has 17
  bin [2.8,2.9) has 13
  bin [2.9,3.0) has 8
  bin [3.0,3.1) has 13
  bin [3.1,3.2) has 12
  bin [3.2,3.3) has 20
  bin [3.3,3.4) has 25
  bin [3.4,3.5) has 29
  bin [3.5,3.6) has 7
  bin [3.6,3.7) has 9
  bin [3.7,3.8) has 4
  bin [3.8,3.9) has 5
  bin [3.9,4.0) has 6
  bin [4.0,4.1) has 6
  bin [4.1,4.2) has 8
  bin [4.2,4.3) has 8
  bin [4.3,4.4) has 8
  bin [4.4,4.5) has 7
  bin [4.5,4.6) has 7
  bin [4.6,4.7) has 6
  bin [4.7,4.8) has 5
  bin [4.8,4.9) has 3
  bin [4.9,5.0) has 3
  bin [5.0,5.1) has 3
  bin [5.1,5.2) has 4
  bin [5.2,5.3) has 8
  bin [5.3,5.4) has 8
  bin [5.4,5.5) has 6
  bin [5.5,5.6) has 5
  bin [5.6,5.7) has 4
  bin [5.7,5.8) has 3
  bin [5.8,5.9) has 3
  bin [5.9,6.0) has 3
  bin [6.0,6.1) has 1
  bin [6.1,6.2) has 4
  bin [6.2,6.3) has 3
  bin [6.3,6.4) has 4
  bin [6.4,6.5) has 2
  bin [6.5,6.6) has 5
  bin [6.6,6.7) has 9
  bin [6.7,6.8) has 3
  bin [6.8,6.9) has 5
  bin [7.0,7.1) has 1
  bin [7.1,7.2) has 1
  bin [7.2,7.3) has 1
  bin [7.3,7.4) has 2
  bin [7.4,7.5) has 2
  bin [7.5,7.6) has 2
  bin [7.6,7.7) has 3
  bin [7.7,7.8) has 2
  bin [7.8,7.9) has 2
  bin [7.9,8.0) has 2
  bin [8.0,8.1) has 4
  bin [8.1,8.2) has 2
  bin [8.2,8.3) has 4
  bin [8.3,8.4) has 1
  bin [8.4,8.5) has 3
  bin [8.5,8.6) has 3
  bin [8.7,8.8) has 1
  bin [8.8,8.9) has 2
  bin [8.9,9.0) has 1
  bin [9.0,9.1) has 3
  bin [9.2,9.3) has 2
  bin [9.4,9.5) has 1
  bin [9.5,9.6) has 1
  bin [9.6,9.7) has 3
  bin [9.7,9.8) has 2
  bin [9.8,9.9) has 2
  bin [9.9,10.0) has 3
  bin [10.0,10.1) has 2
  bin [10.1,10.2) has 1
  bin [10.2,10.3) has 2
  bin [10.4,10.5) has 2
  bin [10.5,10.6) has 2
  bin [10.6,10.7) has 1
  bin [10.8,10.9) has 4
  bin [10.9,11.0) has 1
  bin [11.0,11.1) has 3
  bin [11.2,11.3) has 1
  bin [11.4,11.5) has 1
  bin [11.5,11.6) has 1
  bin [11.7,11.8) has 1
  bin [11.8,11.9) has 1
  bin [11.9,12.0) has 2
  bin [12.0,12.1) has 1
  bin [12.1,12.2) has 1
  bin [12.4,12.5) has 1
  bin [12.5,12.6) has 1
  bin [12.6,12.7) has 1
  bin [12.9,13.0) has 1
  bin [13.0,13.1) has 3
  bin [13.1,13.2) has 4
  bin [13.3,13.4) has 1
  bin [13.4,13.5) has 2
  bin [13.5,13.6) has 1
  bin [13.8,13.9) has 1
  bin [14.1,14.2) has 1
  bin [14.2,14.3) has 2
  bin [14.4,14.5) has 1
  bin [14.5,14.6) has 1
  bin [14.7,14.8) has 2
  bin [15.1,15.2) has 1
  bin [15.3,15.4) has 2
  bin [16.0,16.1) has 1
  bin [16.1,16.2) has 2
  bin [16.6,16.7) has 1
  bin [17.1,17.2) has 1
  bin [17.2,17.3) has 1
  bin [17.6,17.7) has 1
  bin [18.3,18.4) has 1
  bin [18.5,18.6) has 1
  bin [19.7,19.8) has 1
  bin [19.8,19.9) has 1
  bin [20.3,20.4) has 1
  bin [20.4,20.5) has 1
  bin [20.5,20.6) has 1
  bin [20.7,20.8) has 1
  bin [20.9,21.0) has 1
  bin [21.9,22.0) has 1
  bin [22.0,22.1) has 1
  bin [22.3,22.4) has 1
  bin [22.6,22.7) has 1
  bin [22.9,23.0) has 1
  bin [23.0,23.1) has 1
  bin [23.6,23.7) has 1
  bin [23.9,24.0) has 1
  bin [24.6,24.7) has 1
  bin [25.5,25.6) has 1
  bin [25.8,25.9) has 1
  bin [26.0,26.1) has 1
  bin [26.4,26.5) has 1
  bin [27.4,27.5) has 1
  bin [28.5,28.6) has 1
  bin [28.6,28.7) has 1
  bin [29.5,29.6) has 1
  bin [29.6,29.7) has 1
  bin [29.9,30.0) has 1
  bin [31.9,32.0) has 1
  bin [32.2,32.3) has 1
  bin [33.0,33.1) has 1
  bin [34.0,34.1) has 1
  bin [34.1,34.2) has 1
  bin [34.4,34.5) has 1
  bin [34.5,34.6) has 1
  bin [36.5,36.6) has 1
  bin [37.2,37.3) has 1
  bin [37.8,37.9) has 1
  bin [38.6,38.7) has 1
  bin [39.5,39.6) has 1
  bin [40.9,41.0) has 1
  bin [41.5,41.6) has 1
  bin [41.7,41.8) has 1
  bin [42.9,43.0) has 1
  bin [43.6,43.7) has 1
  bin [44.9,45.0) has 1
  average edge length histogram 0.2 for 3945278 element(s)



Reply all
Reply to author
Forward
0 new messages