:: include LAStools in PATH to allow running script from anywhere
set PATH=%PATH%;C:\software\lastools;
:: specify the number of cores to use
set NUM_CORES=3
:: create clean folder for the raw tiles with buffer
rmdir .\tiles_raw /s /q
mkdir .\tiles_raw
:: use lastile to create a buffered tiling from the original
:: flight strips. the flag '-files_are_flightlines' assures
:: that points from different flight lines will get a unique
:: flight lines ID stored in the 'point source ID' attribute
:: that makes it possible to later identify from which points
:: belong to the same flight strip. we use '-tile_size 300'
:: to specify the tile size and request a buffer of 10 meters
:: around every tile with '-buffer 15'. this buffer helps to
:: reduce edge artifacts at tile boundaries in a tile-based
:: processing pipeline. we use values 300 and 15 that
:: divide evenly by the target step size of 0.15. the '-olaz'
:: flag requests compressed output tiles to overcome
:: the I/O bottleneck.
lastile -i strips_raw\*.laz -files_are_flightlines ^
-tile_size 300 -buffer 15 ^
-o tiles_raw\tile.laz -olaz
:: create clean folder for the ground-classified tiles
rmdir .\tiles_ground /s /q
mkdir .\tiles_ground
:: use lasground to find the bare-earth points in all tiles
:: with the '-wilderness' setting (which uses a step of 3m)
:: and the '-fine' setting for the initial ground estimate
:: (see: lasground_README.txt). the '-odir tiles_ground -olaz'
:: parameters specify to store the ground-classified tiles
:: compressed and with the same name to the 'tiles_ground'
:: folder. if we have multiple tiles then this process runs
:: on as many cores as specified by the %NUM_CORES%
:: set above.
lasground -i tiles_raw\*.laz ^
-wilderness -fine ^
-odir tiles_ground -olaz ^
-cores %NUM_CORES%
:: create clean folder for the could-free tiles
rmdir .\tiles_cloudfree /s /q
mkdir .\tiles_cloudfree
:: use lasheight to remove low and high outliers that are often
:: just noise (e.g. clouds or birds). by default lasheight uses
:: the points classified as ground to construct a TIN and then
:: calculates the height of all other points in respect to this
:: ground surface TIN. with '-drop_above 60 -drop_below -3' all
:: points that are 60 meters above the ground or 3 meters below
:: the ground are removed from the output LAZ tiles that are to
:: be stored in the 'tiles_denoised' folder. if we have multiple
:: input files this process runs on %NUM_CORES% many cores.
lasheight -i tiles_ground\*.laz ^
-drop_above 50 -drop_below -3 ^
-odir tiles_cloudfree -olaz ^
-cores %NUM_CORES%
:: create clean folder for the raster DTMs in BIL/HDR format
rmdir .\tiles_dtms /s /q
mkdir .\tiles_dtms
:: run las2dem on the ground-classified tiles to create raster DTMs
:: in binary BIL format (*.bil) for each individual tile. important
:: is the '-keep_class 2' flag that activates a filter letting only
:: the points classified as 'ground' through. in addition we use the
:: '-thin_with_grid 0.075' filter to have only one ground point per
:: 0.075m by 0.075m area. this assures that we construct and
:: sample a TIN appropriate for the output resolution of 1.0m by
:: 1.0m that is set by '-step 0.15'. important is the '-use_tile_bb'
:: parameter that limits rasterizing the TIN to the area *without*
:: the buffer that was added by lastile thereby minimizing potential
:: artifacts along the tile boundaries. the '-odir tiles_dtms -oasc'
:: flags specify to output the resulting DTMs in binary BIL format
:: in the folder 'tiles_dtms' using the same name as the LAZ file
:: but with a *.bil extension. if we have multiple tiles this process
:: will run on as many cores as specified by %NUM_CORES%
:: set above.
las2dem -i tiles_ground\*.laz ^
-keep_class 2 -thin_with_grid 0.075 ^
-step 0.15 -use_tile_bb ^
-odir tiles_dtms -obil ^
-cores %NUM_CORES%
:: combine the individual DTMs into one large DTM
lasgrid -i tiles_dtms\*.bil -merged ^
-step 0.15 ^
-o dtm.img
:: create a slope map for the combined DTM with BLAST
blast2dem -i tiles_dtms\*.bil -merged ^
-step 0.15 -slope ^
-o dtm_slope.tif
Hope this helps. You may need to edit a few parts to work for your particular setup.
Regards,
Martin @rapidlasso
--