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