Shift folder of LAZ files vertically

Feel free to ask any question here
Post Reply
teknick
Posts: 4
Joined: Thu Jul 29, 2021 12:47 am

Shift folder of LAZ files vertically

Post by teknick »

Hi,

I have a folder of LAZ files and I need to push all of these up vertically by 12cm. Loading them all manually will take at least a week, so I am wondering if there is a way to use the command line to:

Open each LAZ file on after another
move up by 12cm
save as <filename>_shifted.LAZ

I am guessing I can use -APPLY_TRANS {filename}, but coming from a simple 3d background I do not understand how to apply 4x4 translations - in my world we just add 12cm to the z axis on an object!

Any help would be much appreciated!
daniel
Site Admin
Posts: 7721
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Shift folder of LAZ files vertically

Post by daniel »

Yes, the APPLY_TRANS is the way to go, and here is the transformation you need:
1 0 0 0
0 1 0 0
0 1 1 120
0 0 0 1

(mind that '12' should actually be expressed in the right units, here I assumed mm, but it may be meters instead? i.e. 0.12?)

And mind also that you should still apply the default Global Shift when loading files with the command line (-GLOBAL_SHIFT AUTO). It won't impact this 12 cm shift thing, and it's safer.
Daniel, CloudCompare admin
teknick
Posts: 4
Joined: Thu Jul 29, 2021 12:47 am

Re: Shift folder of LAZ files vertically

Post by teknick »

Thank you so much Daniel,

For clarity, would you be so kind ask to post the full command that you suggest here? I think I need to save that translation in a text file and then point to it - is that right?
daniel
Site Admin
Posts: 7721
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Shift folder of LAZ files vertically

Post by daniel »

Yes, save the above transformation matrix in a text file (e.g. transformation.txt).

Then use something like that:
CloudCompare -C_EXPORT_FMT LAS -O -GLOBAL_SHIFT AUTO your_file.las -APPLY_TRANS transformation.txt

And if you want to control the output file name:
CloudCompare -AUTO_SAVE OFF -C_EXPORT_FMT LAS -O -GLOBAL_SHIFT AUTO your_file.las -APPLY_TRANS transformation.txt -SAVE_CLOUDS FILE your_file_transformed.las
Daniel, CloudCompare admin
teknick
Posts: 4
Joined: Thu Jul 29, 2021 12:47 am

Re: Shift folder of LAZ files vertically

Post by teknick »

That is great - and is it possible to do on a whole folder of files and just leave them chewing through overnight?
daniel
Site Admin
Posts: 7721
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Shift folder of LAZ files vertically

Post by daniel »

Well, you can if you write the script that does that (going over each file, and calling this command line each time).
Daniel, CloudCompare admin
teknick
Posts: 4
Joined: Thu Jul 29, 2021 12:47 am

Re: Shift folder of LAZ files vertically

Post by teknick »

ah - so it is not like I can point at a folder instead of a file and ask it to process all the files inside and then save with a name append?
daniel
Site Admin
Posts: 7721
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Shift folder of LAZ files vertically

Post by daniel »

Nope, this kind of behavior is generally easier to manage with (system dependent) scripts than within a tool such as CloudCompare ;)
Daniel, CloudCompare admin
Post Reply