1::
2:: an example batch script for thinning a single huge LAS/LAZ file
3:: with a percentile
4::
5
6echo off
7
8::
9:: specify parameters
10::
11
12:: allows you to run the script from other folders
13set PATH=%PATH%;E:\LAStools\bin;
14
15:: specify the resolution of the thinning grid
16set STEP=4.0
17
18:: specify the desired percentile
19set PERCENTILE=10
20
21:: specify the minimum nuber of points to be used for the percentile computation
22set MINIMUM_POINTS=20
23
24:: specify the target claification code for the points matching the percentile
25set CLASSIFY_AS=8
26
27:: specify the size of the temporary tiles. it is important that
28:: the tile size can be evenly divided by the grid resolution
29:: meaning that TILE_SIZE/STEP is XXXX.0 without decimal digits
30set TILE_SIZE=500
31
32:: specify the number of cores to run on
33set NUM_CORES=3
34
35:: specify the name for temporary directory
36set TEMP_DIR=temp_dir_thinning
37
38::
39:: do the actual processing
40::
41
42:: create temporary tile directory
43
44rmdir %TEMP_DIR% /s /q
45mkdir %TEMP_DIR%
46
47:: create a temporary tiling with TILE_SIZE
48
49lastile -i %1 ^
50        -tile_size %TILE_SIZE% ^
51        -o %TEMP_DIR%\tile.laz -olaz
52
53:: thins the tiles on NUM_CORES
54
55lasthin -i %TEMP_DIR%\tile*.laz ^
56        -step %STEP% -percentile %PERCENTILE% %MINIMUM_POINTS%  ^
57        -classify_as %CLASSIFY_AS% ^
58        -odix _p%PERCENTILE% -olaz ^
59        -cores %NUM_CORES%
60
61:: recreate the (less huge) thinned LAS / LAZ file
62
63lasmerge -i %TEMP_DIR%\tile*_p%PERCENTILE%.laz ^
64         -o %1 -odix _p%PERCENTILE%
65
66:: delete the temporary tile directory
67
68rmdir %TEMP_DIR% /s /q
69