1:: 2:: a batch script for converting classified LiDAR tiles into a 3:: number of raster products with a tile-based multi-core batch 4:: pipeline 5:: 6 7:: include LAStools in PATH to allow running script from anywhere 8 9set PATH=%PATH%;..; 10 11:: specify the number of cores to use 12 13set NUM_CORES=1 14 15:: create clean folder for the raster DTMs in ESRI ASCII format 16 17rmdir .\tiles_dtms /s /q 18mkdir .\tiles_dtms 19 20:: run las2dem on the ground-classified tiles to create raster DTMs 21:: in ESRI ASCII format (*.asc) for each individual tile. important 22:: is the '-keep_class 2' flag that activates a filter letting only 23:: the points classified as 'ground' through. in addition we use the 24:: '-thin_with_grid 0.5' filter to have only one ground point per 25:: 0.5m by 0.5m area. this assures that we construct and sample a 26:: TIN appropriate for the output resolution of 1.0m by 1.0m that is 27:: set by '-step 1.0'. very important is the '-use_tile_bb' parameter 28:: that limits rasterizating the TIN to the tile area *without* the 29:: buffer added by lastile in the 'tile_based_lidar_preparation.bat' 30:: batch script thereby avoiding any potential edge artifacts along 31:: the tile boundaries. the '-odir tiles_dtms -oasc' flags specify 32:: to output the resulting DTMs in ESRI's ASCII format in the folder 33:: 'tiles_dtms' using the same name as the LAZ file but with a *.asc 34:: extension. if we have multiple tiles then this process will run 35:: on as many cores as specified by the %NUM_CORES% set above. 36 37las2dem -i tiles_ground\*.laz ^ 38 -keep_class 2 -thin_with_grid 0.5 -step 1.0 -use_tile_bb ^ 39 -odir tiles_dtms -oasc ^ 40 -cores %NUM_CORES% 41 42:: create clean folder for the hillshaded DTM rasters 43 44rmdir .\tiles_hillshaded_dtms /s /q 45mkdir .\tiles_hillshaded_dtms 46 47:: use las2dem to create individual hillshaded DTM rasters from the 48:: LiDAR points that were classified as ground in each tile. important 49:: again is the '-keep_class 2' flag to only use ground points. with 50:: '-thin_with_grid 0.5' we again use only one ground point per 0.5m 51:: by 0.5m area. this makes the size of the TIN triangles (that are 52:: '-hillshade'd using smooth vertex normals) more appropriate for 53:: the output resolution of 1.0m by 1.0m that is set by '-step 1.0'. 54:: again, the '-use_tile_bb' parameter omits the buffer that was added 55:: by lastile from rasterization to avoid artifacts along the tile 56:: boundaries. the '-odir tiles_hillshaded_dtms -opng' flags specify 57:: to output the resulting hillshades in PNG format in the folder 58:: 'tiles_hillshaded_dtms' using the same file name but with a *.png 59:: extension. if we have multiple tiles then this process will run 60:: on as many cores as specified by the %NUM_CORES% set above. 61 62las2dem -i tiles_ground\*.laz ^ 63 -keep_class 2 -thin_with_grid 0.5 -step 1.0 -use_tile_bb -hillshade ^ 64 -odir tiles_hillshaded_dtms -opng ^ 65 -cores %NUM_CORES% 66 67:: use las2dem to create a single hillshaded DTM raster from on-the 68:: fly merged ASC rasters. all LAStools can read ASC (and BIL) rasters 69:: that are converted into simple xyz points. the '-merged' flag lets 70:: multiple files appear as a single LAS input. the output resolution 71:: is specified by '-step 1.0' and '-hillshade' means that at each TIN 72:: vertex a smooth normal is computed that - together with the default 73:: light direction (0.5 0.5 1.0) - generates the shading. 74 75las2dem -i tiles_dtms\*.asc -merged ^ 76 -step 1.0 -hillshade ^ 77 -o hillshaded_dtm.png 78 79:: same as before but with a different light direction (1.0 0.0 0.5) 80 81las2dem -i tiles_dtms\*.asc -merged ^ 82 -step 1.0 -hillshade -light 1.0 0.0 0.5 ^ 83 -o hillshaded_dtm1.png 84 85:: same as before but with a different light direction (1.0 1.0 0.1) 86 87las2dem -i tiles_dtms\*.asc -merged ^ 88 -step 1.0 -hillshade -light 1.0 1.0 0.1 ^ 89 -o hillshaded_dtm2.png 90 91:: same as before but with a different light direction (0.0 1.0 0.2) 92 93las2dem -i tiles_dtms\*.asc -merged ^ 94 -step 1.0 -hillshade -light 0.0 1.0 0.2 ^ 95 -o hillshaded_dtm3.png 96 97:: same as before but using the actual LiDAR ground points from final 98:: tiles (i.e. those without buffer) with an additional '-extra_pass' 99:: flag that does an initial pass over the input to count the number 100:: of points that survive the filtering for optimal memory management. 101 102las2dem -i tiles_final\*.laz -merged ^ 103 -keep_class 2 -thin_with_grid 0.5 -extra_pass ^ 104 -step 1.0 -hillshade -light 0.0 1.0 0.2 ^ 105 -o hillshaded_dtm3_points.png 106 107:: create clean folder for the false-colored slope DTM rasters 108 109rmdir .\tiles_slope_dtms /s /q 110mkdir .\tiles_slope_dtms 111 112:: use las2dem to create individual false-colored slope DTM rasters 113:: from the LiDAR points of each ground-classified tile. we use the 114:: '-keep_class 2 -thin_with_grid 0.5 -step 1.0 -use_tile_bb' flags 115:: for the same reasons as before. in addition we specify to compute 116:: the '-slope' at when we sample the TIN and map it to a '-false' 117:: color that is stored in PNG format. again we spawn the number of 118:: specified processes in case there are multiple input files. 119 120las2dem -i tiles_ground\*.laz ^ 121 -keep_class 2 -thin_with_grid 0.5 -step 1.0 -use_tile_bb -slope -false ^ 122 -odir tiles_slope_dtms -opng ^ 123 -cores %NUM_CORES% 124 125:: use las2dem to create a single false-colored slope DTM raster from 126:: on-the fly merged ASC rasters. all LAStools can read ASC (and BIL) 127:: rasters that are converted into simple xyz points. the '-merged' flag 128:: lets multiple files appear as a single LAS input. the output resolution 129:: is specified by '-step 1.0' and '-slope' means that at each TIN vertex 130:: a smooth normal is computed to estimate the slope that is interpolated 131:: across the sampled TIN facets. The '-false' flag indicates that the 132:: slope value is mapped to a false coloring that is output in PNG format. 133 134las2dem -i tiles_dtms\*.asc -merged ^ 135 -step 1.0 -slope -false ^ 136 -o slope_dtm.png 137 138:: same as before but using the actual LiDAR ground points from final 139:: tiles (i.e. those without buffer) with an additional '-extra_pass' 140:: flag that does an initial pass over the input to count the number 141:: of points that survive the filtering for optimal memory management. 142 143las2dem -i tiles_final\*.laz -merged ^ 144 -keep_class 2 -thin_with_grid 0.5 -extra_pass ^ 145 -step 1.0 -slope -false ^ 146 -o slope_dtm_points.png 147 148:: use las2dem to create a hillshaded DSM raster from the LiDAR points 149:: of the '-merged' final tiles. with '-first_only' we keep only the 150:: highest (aka the surface) points and with '-thin_with_grid 0.5' we 151:: subset them to an appropriate spacing of TIN vertices for our output 152:: resolution of 1.0m by 1.0m. 153 154las2dem -i tiles_final\*.laz -merged ^ 155 -first_only -thin_with_grid 0.5 -extra_pass ^ 156 -step 1.0 -hillshade ^ 157 -o hillshaded_dsm.png 158