1::
2:: Best practice to generate a pit-free raster Canopy Height Model (CHM) with LAStools
3::
4:: Read more at
5::
6:: http://rapidlasso.com/2014/11/04/rasterizing-perfect-canopy-height-models-from-lidar/
7::
8
9set PATH=%PATH%;..;
10set INPUT=sample.laz
11set STEP=0.5
12set HALF_STEP=0.25
13set KILL=1.5
14
15:: ground classify LiDAR
16
17lasground -i %INPUT% -wilderness -o ground.laz
18
19:: normalize the LiDAR data
20
21lasheight -i ground.laz -replace_z -o normalized.laz
22
23:: create CHM with highest point per grid cell with lasgrid
24
25lasgrid -i normalized.laz -step %STEP% -highest -false -set_min_max 0 65 -o chm_grd.png
26
27:: create CHM with highest point per grid cell with lasgrid and 10 cm circles
28
29lasgrid -i normalized.laz -subcircle 0.05 -step %STEP% -highest -false -set_min_max 0 65 -o chm_grd_d10.png
30
31:: create CHM with highest point per grid cell with lasgrid and 5 cm circles
32
33lasgrid -i normalized.laz -subcircle 0.025 -step %STEP% -highest -false -set_min_max 0 65 -o chm_grd_d05.png
34
35:: create CHM with modified pit-free algorithm using 10 cm circles
36
37rmdir temp_dir /s /q
38mkdir temp_dir
39las2dem -i normalized.laz -drop_z_above 0.1 -step %STEP% -o temp_dir/chm_ground.bil
40lasthin -i normalized.laz -subcircle 0.05 -step %HALF_STEP% -highest -o temp.laz
41las2dem -i temp.laz -step %STEP% -kill %KILL% -o temp_dir/chm_00.bil
42las2dem -i temp.laz -drop_z_below  2 -step %STEP% -kill %KILL% -o temp_dir/chm_02.bil
43las2dem -i temp.laz -drop_z_below  5 -step %STEP% -kill %KILL% -o temp_dir/chm_05.bil
44las2dem -i temp.laz -drop_z_below 10 -step %STEP% -kill %KILL% -o temp_dir/chm_10.bil
45las2dem -i temp.laz -drop_z_below 15 -step %STEP% -kill %KILL% -o temp_dir/chm_15.bil
46las2dem -i temp.laz -drop_z_below 20 -step %STEP% -kill %KILL% -o temp_dir/chm_20.bil
47las2dem -i temp.laz -drop_z_below 25 -step %STEP% -kill %KILL% -o temp_dir/chm_25.bil
48las2dem -i temp.laz -drop_z_below 30 -step %STEP% -kill %KILL% -o temp_dir/chm_30.bil
49las2dem -i temp.laz -drop_z_below 35 -step %STEP% -kill %KILL% -o temp_dir/chm_35.bil
50las2dem -i temp.laz -drop_z_below 40 -step %STEP% -kill %KILL% -o temp_dir/chm_40.bil
51las2dem -i temp.laz -drop_z_below 45 -step %STEP% -kill %KILL% -o temp_dir/chm_45.bil
52las2dem -i temp.laz -drop_z_below 50 -step %STEP% -kill %KILL% -o temp_dir/chm_50.bil
53las2dem -i temp.laz -drop_z_below 55 -step %STEP% -kill %KILL% -o temp_dir/chm_55.bil
54las2dem -i temp.laz -drop_z_below 60 -step %STEP% -kill %KILL% -o temp_dir/chm_60.bil
55las2dem -i temp.laz -drop_z_below 65 -step %STEP% -kill %KILL% -o temp_dir/chm_65.bil
56lasgrid -i temp_dir/chm*.bil -merged -step %STEP% -highest -false -set_min_max 0 65 -o chm_pit_free_d10.png
57rmdir temp_dir /s /q
58
59:: same as above but even more conservative by using 5 cm instead of 10 cm circles
60
61rmdir temp_dir /s /q
62mkdir temp_dir
63las2dem -i normalized.laz -drop_z_above 0.1 -step %STEP% -o temp_dir/chm_ground.bil
64lasthin -i normalized.laz -subcircle 0.025 -step %HALF_STEP% -highest -o temp.laz
65las2dem -i temp.laz -step %STEP% -kill %KILL% -o temp_dir/chm_00.bil
66las2dem -i temp.laz -drop_z_below  2 -step %STEP% -kill %KILL% -o temp_dir/chm_02.bil
67las2dem -i temp.laz -drop_z_below  5 -step %STEP% -kill %KILL% -o temp_dir/chm_05.bil
68las2dem -i temp.laz -drop_z_below 10 -step %STEP% -kill %KILL% -o temp_dir/chm_10.bil
69las2dem -i temp.laz -drop_z_below 15 -step %STEP% -kill %KILL% -o temp_dir/chm_15.bil
70las2dem -i temp.laz -drop_z_below 20 -step %STEP% -kill %KILL% -o temp_dir/chm_20.bil
71las2dem -i temp.laz -drop_z_below 25 -step %STEP% -kill %KILL% -o temp_dir/chm_25.bil
72las2dem -i temp.laz -drop_z_below 30 -step %STEP% -kill %KILL% -o temp_dir/chm_30.bil
73las2dem -i temp.laz -drop_z_below 35 -step %STEP% -kill %KILL% -o temp_dir/chm_35.bil
74las2dem -i temp.laz -drop_z_below 40 -step %STEP% -kill %KILL% -o temp_dir/chm_40.bil
75las2dem -i temp.laz -drop_z_below 45 -step %STEP% -kill %KILL% -o temp_dir/chm_45.bil
76las2dem -i temp.laz -drop_z_below 50 -step %STEP% -kill %KILL% -o temp_dir/chm_50.bil
77las2dem -i temp.laz -drop_z_below 55 -step %STEP% -kill %KILL% -o temp_dir/chm_55.bil
78las2dem -i temp.laz -drop_z_below 60 -step %STEP% -kill %KILL% -o temp_dir/chm_60.bil
79las2dem -i temp.laz -drop_z_below 65 -step %STEP% -kill %KILL% -o temp_dir/chm_65.bil
80lasgrid -i temp_dir/chm*.bil -merged -step %STEP% -highest -false -set_min_max 0 65 -o chm_pit_free_d05.png
81rmdir temp_dir /s /q
82
83