Exporting Raster with given file name

Feel free to ask any question here
Post Reply
boléro
Posts: 3
Joined: Wed Nov 22, 2023 2:57 pm

Exporting Raster with given file name

Post by boléro »

Thanks a lot for such a wonderful tool!
I want to rasterize LiDAR data (laz file) by using the command line and -RASTERIZE function.
Everything works fine, but I want to specify a output name while using the -OUTPUT_RASTER_Z_AND_SF function.
I tried to add the -NO_TIMESTEMP command but nothing changed.

This is my cmd code structure (input_folder etc. specified before):
for /L %%i in (0,1,21) do (
set "input_file=!input_folder!\lidar_lae_tower_pcsrt_06_15_08_18_%%i.laz"
set "output_file=!output_folder!\lidar_pcsrt_%%i_rasterized.tif"

REM Use CloudCompare CLI to rasterize the LiDAR data
"%cloudcompare_path%" -SILENT -O "!input_file!" -RASTERIZE -GRID_STEP 0.1 -PROJ MAX -SF_PROJ MAX -OUTPUT_RASTER_Z_AND_SF -NO_TIMESTAMP (here I want to input e.g. "!output_file!")
echo Rasterization completed for %%i
Pause
)

echo All files processed.

Is there a way to do that? Thanks a lot for your help!
daniel
Site Admin
Posts: 7709
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Exporting Raster with given file name

Post by daniel »

Hum, I looked at the code, and it doesn't seem possible to choose the raster filename at the moment. One would have to add a specific option for that (it's a sub-obtion of the -RASTERIZE function, not the general output file naming convention).
Daniel, CloudCompare admin
boléro
Posts: 3
Joined: Wed Nov 22, 2023 2:57 pm

Re: Exporting Raster with given file name

Post by boléro »

Thanks a lot for your answer.
I've found a solution by incorporating it in the batch script, but outside the -RASTERIZE command (and moved the file to a new folder):
for /L %%i in (0,1,21) do (
set "input_file=!input_folder!\lidar_lae_tower_pcsrt_06_15_08_18_%%i.laz"

REM Use CloudCompare CLI to rasterize the LiDAR data
"%cloudcompare_path%" -SILENT -O "!input_file!" -RASTERIZE -GRID_STEP 0.1 -PROJ MAX -SF_PROJ MAX -OUTPUT_RASTER_Z_AND_SF
echo Rasterization completed for %%i

set "timestamp="
for /f "tokens=4,5 delims=_." %%a in ("!input_file!") do set "timestamp=%%a_%%b"

set "new_filename=!prefix!%%i%extension%"
move "!input_folder!\lidar_lae_tower_pcsrt_06_15_08_18_%%i*.tif" "%output_folder%\!new_filename!" || echo Failed to move "!output_folder!\lidar_lae_tower_pcsrt_06_15_08_18_%%i*.tif"
)

endlocal

If anybody is dealing with the same issue :)
daniel
Site Admin
Posts: 7709
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Exporting Raster with given file name

Post by daniel »

Nice, thanks for the tip.
Daniel, CloudCompare admin
boléro
Posts: 3
Joined: Wed Nov 22, 2023 2:57 pm

Re: Exporting Raster with given file name

Post by boléro »

Another question regarding the application of the RASTERIZE function:
Do I understand this correctly that if I chose the -PROJ and the -SF_PROJ as MAX, I will rasterize my Point-Cloud with the highest point (in Z direction) and the layer value of the respective point. Or how must I use the -SF_PROJ command?
Thanks a lot for your answer!
daniel
Site Admin
Posts: 7709
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Exporting Raster with given file name

Post by daniel »

So the -SF_PROJ MAX option will take the max SF value inside the cell (not the one of the highest point selected by -SF_PROJ MAX).

There's strangely no option to do what you ask for!
Daniel, CloudCompare admin
Post Reply