1::
2:: Ways to generate 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%;D:\LAStools\bin;
10
11:: global definitions
12
13set MUNICIPALITY=tab
14set BLOCK=vsu
15set STEP=0.5
16set SUBGRIDSTEP=0.25
17set KILL=1.5
18set MIN_MAX=0 15
19set CORES=6
20
21:: below are all the used command lines used in this article
22
23:: tile the LiDAR
24
25:: ground classify LiDAR
26
27:: normalize the LiDAR data
28
29lasheight -i %BLOCK%\tiles_ground\%MUNICIPALITY%*.laz ^
30          -replace_z ^
31          -classify_below -2 7 ^
32          -classify_above 50 7 ^
33          -odir %BLOCK%\tiles_normalized -olaz ^
34          -cores %CORES%
35
36:: create CHM simply with highest point per grid cell with lasgrid
37
38lasgrid -i %BLOCK%\tiles_normalized\%MUNICIPALITY%*.laz ^
39        -step %STEP% -highest ^
40        -false -set_min_max %MIN_MAX% ^
41        -use_tile_bb ^
42        -odir %BLOCK%\tiles_chm -odix "_grd_d00" -opng ^
43        -cores %CORES%
44
45:: same as above but "splat" points into small circles with diameter 20 cm
46
47:GRID_D20
48
49lasgrid -i %BLOCK%\tiles_normalized\%MUNICIPALITY%*.laz ^
50        -subcircle 0.1 ^
51        -step %STEP% -highest ^
52        -false -set_min_max %MIN_MAX% ^
53        -use_tile_bb ^
54        -odir %BLOCK%\tiles_chm -odix "_grd_d20" -opng ^
55        -cores %CORES%
56
57:: create CHM by rasterizing TIN of all first returns with las2dem
58
59:TIN_D00
60
61las2dem -i %BLOCK%\tiles_normalized\%MUNICIPALITY%*.laz ^
62        -first_only ^
63        -step %STEP% ^
64        -false -set_min_max %MIN_MAX% ^
65        -use_tile_bb ^
66        -odir %BLOCK%\tiles_chm -odix "_tin_d00" -opng ^
67        -cores %CORES%
68
69:: create CHM by rasterizing TIN of highest point per finer (sub-)grid cell after "splatting" points into small frisbees of 20 cm diameter
70
71:TIN_D20
72
73rmdir %BLOCK%\tmp_dir /s /q
74mkdir %BLOCK%\tmp_dir
75
76lasthin -i %BLOCK%\tiles_normalized\%MUNICIPALITY%*.laz ^
77        -subcircle 0.1 ^
78        -step %SUBGRIDSTEP% -highest ^
79        -odir %BLOCK%\tmp_dir -olaz ^
80        -cores %CORES%
81
82las2dem -i %BLOCK%\tmp_dir\%MUNICIPALITY%*.laz ^
83        -step %STEP% ^
84        -false -set_min_max %MIN_MAX% ^
85        -use_tile_bb ^
86        -odir %BLOCK%\tiles_chm -odix "_tin_d20" -opng ^
87        -cores %CORES%
88
89rmdir %BLOCK%\tmp_dir /s /q
90
91:: create CHM with modified pit-free algorithm
92
93:PIT_FREE
94
95rmdir %BLOCK%\tmp_dir /s /q
96mkdir %BLOCK%\tmp_dir
97
98lasthin -i %BLOCK%\tiles_normalized\%MUNICIPALITY%*.laz ^
99        -subcircle 0.1 ^
100        -step %SUBGRIDSTEP% -highest ^
101        -odir %BLOCK%\tmp_dir -olaz ^
102        -cores %CORES%
103
104las2dem -i %BLOCK%\tmp_dir\%MUNICIPALITY%*.laz ^
105        -drop_z_above 0.1 ^
106        -step %STEP% ^
107        -use_tile_bb ^
108        -odir %BLOCK%\tmp_dir -odix "_chm_GP" -obil ^
109        -cores %CORES%
110
111las2dem -i %BLOCK%\tmp_dir\%MUNICIPALITY%*.laz ^
112        -step %STEP% ^
113        -kill %KILL% ^
114        -use_tile_bb ^
115        -odir %BLOCK%\tmp_dir -odix "_chm_00" -obil ^
116        -cores %CORES%
117
118las2dem -i %BLOCK%\tmp_dir\%MUNICIPALITY%*.laz ^
119        -drop_z_below  2 ^
120        -step %STEP% ^
121        -kill %KILL% ^
122        -use_tile_bb ^
123        -odir %BLOCK%\tmp_dir -odix "_chm_02" -obil ^
124        -cores %CORES%
125
126las2dem -i %BLOCK%\tmp_dir\%MUNICIPALITY%*.laz ^
127        -drop_z_below  5 ^
128        -step %STEP% ^
129        -kill %KILL% ^
130        -use_tile_bb ^
131        -odir %BLOCK%\tmp_dir -odix "_chm_05" -obil ^
132        -cores %CORES%
133
134las2dem -i %BLOCK%\tmp_dir\%MUNICIPALITY%*.laz ^
135        -drop_z_below 8 ^
136        -step %STEP% ^
137        -kill %KILL% ^
138        -use_tile_bb ^
139        -odir %BLOCK%\tmp_dir -odix "_chm_08" -obil ^
140        -cores %CORES%
141
142las2dem -i %BLOCK%\tmp_dir\%MUNICIPALITY%*.laz ^
143        -drop_z_below 11 ^
144        -step %STEP% ^
145        -kill %KILL% ^
146        -use_tile_bb ^
147        -odir %BLOCK%\tmp_dir -odix "_chm_11" -obil ^
148        -cores %CORES%
149
150las2dem -i %BLOCK%\tmp_dir\%MUNICIPALITY%*.laz ^
151        -drop_z_below 14 ^
152        -step %STEP% ^
153        -kill %KILL% ^
154        -use_tile_bb ^
155        -odir %BLOCK%\tmp_dir -odix "_chm_14" -obil ^
156        -cores %CORES%
157
158lasgrid -i %BLOCK%\tmp_dir\%MUNICIPALITY%*.bil -merged ^
159        -step %STEP% ^
160        -highest ^
161        -false -set_min_max %MIN_MAX% ^
162        -use_bb ^
163        -o %BLOCK%\chm_pit_free.png
164
165rmdir %BLOCK%\tmp_dir /s /q
166
167
168
169
170