Suppose the following:
- MCC-LIDAR software is installed in
C:\Program Files (x86)
.
- Input .las files are stored in
C:\test\input
.
- Outputs (also with extension .las) are going to be stored in
C:\test\output
.
The first alternative is an improved version from K.B's code from your sourceforge link:
PATH="C:\Program Files (x86)\MCC-LIDAR 2.1\bin";%PATH%
FOR %%W IN (C:\test\input\*.las) DO (
mcc-lidar %%W C:\test\output\%%~NXW -s 0.5 -t 0.07
)
PAUSE
Here is a brief explanation:
PATH="C:\Program Files (x86)\MCC-LIDAR 2.1\bin";%PATH%
Maps the MCC-LiDAR software in the system's account Environment Variables, so the mcc-lidar.exe
program can be recognized.
FOR %%W IN (C:\test\input\*.las) DO (
Do something with all (*) .las files in C:\test\input\
. Since it is a for
loop 'something' is done file by file.
mcc-lidar %%W C:\test\output\%%~NXW -s 0.5 -t 0.07
At each step in the loop, apply the mcc-lidar.exe tool to a .las file and save it with the same name in folder C:\test\output\
. What makes it to be saved with the same name are the modifiers ~NX
(~Name and ~eXtension, respectively) appended to variable %%W
. For example %%W
is C:\test\input\data1.las
and %%~NXW
is data1.las
.
)
PAUSE
The parenthesis closes the loop and PAUSE
keeps the prompt window opened, so one can read all that was gone through.
Another alternative, can be used when one has some sort of index number in the input filename. For example: data1.las, data2.las, ..., data6.las, etc.
Then, use the following code:
PATH="C:\Program Files (x86)\MCC-LIDAR 2.1\bin";%PATH%
FOR /L %%W IN (1,1,6) DO (
mcc-lidar C:\test\input\data%%W.las C:\test\output\data%%W.las -s 0.5 -t 0.07
)
PAUSE
The code explanation is in Clipping LAS data with multiple shapefiles.
If your final goal is to build a DEM, then take a look at a related post:
Determining bare earth DEM from unclassified LAS file?