forked from LAStools/LAStools
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenerating_a_pit_free_chm.bat
More file actions
88 lines (65 loc) · 2.29 KB
/
generating_a_pit_free_chm.bat
File metadata and controls
88 lines (65 loc) · 2.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
::
:: a batch script for generating a pit-free CHM as outlined
:: in the Silvilaser 2013 poster by A. Khosravipour et al.
::
::
:: specify parameters
::
:: allows you to run the script from other folders
set PATH=%PATH%;D:\lastools\bin;
:: here we specify the input (already height-normalized)
set NORMALIZED_LIDAR=D:\data\normalized\bois_noir.laz
:: specify the desired resolution
set STEP=0.5
:: specify the desired triangle kill (about 3 times the step)
set KILL=1.5
:: specify a temporary directory for the partial CHMs
set TEMP_CHM_DIR=temp_chms
:: specify the final output CHM file name and format
set PIT_FREE_CHM=D:\data\result\chm.tif
rmdir %TEMP_CHM_DIR% /s /q
mkdir %TEMP_CHM_DIR%
::
:: do the actual processing
::
blast2dem -i %NORMALIZED_LIDAR% ^
-keep_first ^
-step %STEP% ^
-odir %TEMP_CHM_DIR% -odix _00 -obil
blast2dem -i %NORMALIZED_LIDAR% ^
-keep_first -drop_z_below 2 ^
-step %STEP% -kill %KILL% ^
-odir %TEMP_CHM_DIR% -odix _02 -obil
blast2dem -i %NORMALIZED_LIDAR% ^
-keep_first -drop_z_below 5 ^
-step %STEP% -kill %KILL% ^
-odir %TEMP_CHM_DIR% -odix _05 -obil
blast2dem -i %NORMALIZED_LIDAR% ^
-keep_first -drop_z_below 10 ^
-step %STEP% -kill %KILL% ^
-odir %TEMP_CHM_DIR% -odix _10 -obil
blast2dem -i %NORMALIZED_LIDAR% ^
-keep_first -drop_z_below 15 ^
-step %STEP% -kill %KILL% ^
-odir %TEMP_CHM_DIR% -odix _15 -obil
:: this would be sufficient for forests with tree height
:: of up to about 20 meter. maybe delete higher up steps
blast2dem -i %NORMALIZED_LIDAR% ^
-keep_first -drop_z_below 20 ^
-step %STEP% -kill %KILL% ^
-odir %TEMP_CHM_DIR% -odix _20 -obil
blast2dem -i %NORMALIZED_LIDAR% ^
-keep_first -drop_z_below 25 ^
-step %STEP% -kill %KILL% ^
-odir %TEMP_CHM_DIR% -odix _25 -obil
blast2dem -i %NORMALIZED_LIDAR% ^
-keep_first -drop_z_below 30 ^
-step %STEP% -kill %KILL% ^
-odir %TEMP_CHM_DIR% -odix _30 -obil
:: merge partial CHMs together into pit-free CHM
lasgrid -i %TEMP_CHM_DIR%\*.bil -merged ^
-step %STEP% -highest ^
-o %PIT_FREE_CHM%
:: remove the temporary files and directory
rmdir %TEMP_CHM_DIR% /s /q
echo "bye bye"