Using laszip on root directory as well as subdirectories

199 views
Skip to first unread message

Jordan Rising

unread,
Apr 14, 2019, 1:45:52 PM4/14/19
to LAStools - efficient tools for LiDAR processing
I've been running laszip via command line with a .bat file to start chipping away at file size on our server. .Going from .las -> .laz is a huge space saver for us. However, it is fairly laborious to copy/paste this .bat file to every directory that has a .las and run it.

Does anybody have any experience or help they could provide with running laszip on a directory AND its sub directories? I've set laszip in my environmental variables, so currently my command looks like this to do a .las->.laz then delete the old .las:

laszip -i *.las
del *.las

Thanks for all the help!

Terje Mathisen

unread,
Apr 14, 2019, 1:59:07 PM4/14/19
to last...@googlegroups.com, Jordan Rising
The easiest (if you have 10-20% spare room on your disks) is probably to
just do this:

dir *.las /b /s > filelist.txt
las2las -lof filelist.txt -olaz

I believe this should generate a laz file for every las file in the
directory structure.

After you've verified that this is OK you can do a recursive delete of
all the las files.

Terje

--
- <Terje.M...@tmsw.no>
"almost all programming can be viewed as an exercise in caching"

Martin Isenburg

unread,
Apr 14, 2019, 2:01:07 PM4/14/19
to LAStools - efficient command line tools for LIDAR processing
Do *not* use las2las for compression. Only laszip is a lossless compressor. The las2las tool is meant for file modifications and will leave it's mark on your file. Compression will not be 100% lossless. The LAS header will be modified slightly.

Jordan Rising

unread,
Apr 14, 2019, 2:14:28 PM4/14/19
to LAStools - efficient tools for LiDAR processing
This worked perfect! I changed las2las to laszip per Martin's recommendation. Martin, is that sufficient then for a lossless compression?

Thanks for both of your help.

Jordan Rising

unread,
Apr 14, 2019, 4:36:04 PM4/14/19
to LAStools - efficient tools for LiDAR processing
So here is what I'm going forward with, let me know if this throws any red flags in your mind.

dir *.las /b /s > TEMPfilelist.txt
laszip -lof TEMPfilelist.txt -olaz
del /s *.las

On Sunday, April 14, 2019 at 12:01:07 PM UTC-6, Martin Isenburg wrote:
Do *not* use las2las for compression. Only laszip is a lossless compressor. The las2las tool is meant for file modifications and will leave it's mark on your file. Compression will not be 100% lossless. The LAS header will be modified slightly.

On Sun, Apr 14, 2019 at 7:59 PM Terje Mathisen <terje....@tmsw.no> wrote:
Jordan Rising wrote:
> I've been running laszip via command line with a .bat file to start
> chipping away at file size on our server. .Going from .las -> .laz is
> a huge space saver for us. However, it is fairly laborious to
> copy/paste this .bat file to every directory that has a .las and run it.
>
> Does anybody have any experience or help they could provide with
> running laszip on a directory AND its sub directories? I've set laszip
> in my environmental variables, so currently my command looks like this
> to do a .las->.laz then delete the old .las:
>
> laszip -i *.las
> del *.las
>

The easiest (if you have 10-20% spare room on your disks) is probably to
just do this:

dir *.las /b /s > filelist.txt
las2las -lof filelist.txt -olaz

I believe this should generate a laz file for every las file in the
directory structure.

After you've verified that this is OK you can do a recursive delete of
all the las files.

Terje

--

Terje Mathisen

unread,
Apr 14, 2019, 8:48:19 PM4/14/19
to last...@googlegroups.com, Jordan Rising
As long as you have a full backup of the original LAS files somewhere, that should be perfectly OK, but if you don't have that, then I would prefer to have more of a safety belt, i.e. a verification step that shows each and every file has been converted OK before the LAS version is deleted.

I would probably make a perl script (since that's what I do for most batch-style tasks) which would recurse through the directories, and for each found LAS file, I would make the LAZ copy, then run lasdiff to verify that they were the same, before deleting the LAS.
:-)

Terje

Jordan Rising wrote:

Jeffrey Osborne

unread,
Apr 15, 2019, 11:41:48 AM4/15/19
to LAStools - efficient tools for LiDAR processing
Are differences in the LAS header the only changes introduced by outputing laz with las2las though? What changes would appear in the header if used as in Jordan's first post? 


On Sunday, April 14, 2019 at 3:01:07 PM UTC-3, Martin Isenburg wrote:
Do *not* use las2las for compression. Only laszip is a lossless compressor. The las2las tool is meant for file modifications and will leave it's mark on your file. Compression will not be 100% lossless. The LAS header will be modified slightly.

On Sun, Apr 14, 2019 at 7:59 PM Terje Mathisen <terje....@tmsw.no> wrote:
Jordan Rising wrote:
> I've been running laszip via command line with a .bat file to start
> chipping away at file size on our server. .Going from .las -> .laz is
> a huge space saver for us. However, it is fairly laborious to
> copy/paste this .bat file to every directory that has a .las and run it.
>
> Does anybody have any experience or help they could provide with
> running laszip on a directory AND its sub directories? I've set laszip
> in my environmental variables, so currently my command looks like this
> to do a .las->.laz then delete the old .las:
>
> laszip -i *.las
> del *.las
>

The easiest (if you have 10-20% spare room on your disks) is probably to
just do this:

dir *.las /b /s > filelist.txt
las2las -lof filelist.txt -olaz

I believe this should generate a laz file for every las file in the
directory structure.

After you've verified that this is OK you can do a recursive delete of
all the las files.

Terje

--

Martin Isenburg

unread,
Apr 15, 2019, 4:50:56 PM4/15/19
to LAStools - efficient command line tools for LIDAR processing
Hello,

here is a workflow:

C:\software\LAStools\bin>mkdir compressiontest

C:\software\LAStools\bin>laszip -i ..\data\*.laz -odir compressiontest -olas

C:\software\LAStools\bin>dir compressiontest

04/15/2019  10:28 PM    <DIR>          .
04/15/2019  10:28 PM    <DIR>          ..
04/15/2019  10:28 PM         2,833,997 france.las
04/15/2019  10:28 PM         7,772,365 fusa.las
04/15/2019  10:28 PM         1,598,673 house.las
04/15/2019  10:28 PM         2,873,645 lake.las
04/15/2019  10:28 PM         4,211,533 sample.las
04/15/2019  10:28 PM           236,521 test.las
04/15/2019  10:28 PM         5,966,833 TO_core_last_zoom.las
04/15/2019  10:28 PM        18,391,665 zurich.las
               8 Datei(en),     43,885,232 Bytes

C:\software\LAStools\bin>dir compressiontest\*.las /b /s > filelist.txt

C:\software\LAStools\bin>laszip -lof filelist.txt

C:\software\LAStools\bin>dir compressiontest

04/15/2019  10:31 PM    <DIR>          .
04/15/2019  10:31 PM    <DIR>          ..
04/15/2019  10:28 PM         2,833,997 france.las
04/15/2019  10:31 PM           335,514 france.laz
04/15/2019  10:28 PM         7,772,365 fusa.las
04/15/2019  10:31 PM         1,078,962 fusa.laz
04/15/2019  10:28 PM         1,598,673 house.las
04/15/2019  10:31 PM           285,509 house.laz
04/15/2019  10:28 PM         2,873,645 lake.las
04/15/2019  10:31 PM           483,879 lake.laz
04/15/2019  10:28 PM         4,211,533 sample.las
04/15/2019  10:31 PM           794,383 sample.laz
04/15/2019  10:28 PM           236,521 test.las
04/15/2019  10:31 PM            67,614 test.laz
04/15/2019  10:28 PM         5,966,833 TO_core_last_zoom.las
04/15/2019  10:31 PM           585,158 TO_core_last_zoom.laz
04/15/2019  10:28 PM        18,391,665 zurich.las
04/15/2019  10:31 PM         2,712,189 zurich.laz
              16 Datei(en),     50,228,440 Bytes

C:\software\LAStools\bin>lasdiff -lof filelist.txt 2> compressiontest\lasdiff_log.txt

The resulting lasdiff_log.txt file is attached. That may be enough already.

If you want to do another or alternate test you can also do the one below. But God Forbid (!!!) ... do not forget the -check in the command line or else your compressed files will get decompressed to disk and you will override the originals!!!

Regards,

Martin @rapidlasso

================================================

C:\software\LAStools\bin>dir compressiontest\*.laz /b /s > filelist_compressed.txt

C:\software\LAStools\bin>laszip -check -lof filelist_compressed.txt
SUCCESS for 'C:\software\LAStools\bin\compressiontest\france.laz'
SUCCESS for 'C:\software\LAStools\bin\compressiontest\fusa.laz'
SUCCESS for 'C:\software\LAStools\bin\compressiontest\house.laz'
SUCCESS for 'C:\software\LAStools\bin\compressiontest\lake.laz'
SUCCESS for 'C:\software\LAStools\bin\compressiontest\sample.laz'
SUCCESS for 'C:\software\LAStools\bin\compressiontest\test.laz'
SUCCESS for 'C:\software\LAStools\bin\compressiontest\TO_core_last_zoom.laz'
SUCCESS for 'C:\software\LAStools\bin\compressiontest\zurich.laz'
lasdiff_log.txt

Jordan Rising

unread,
Apr 16, 2019, 12:43:02 PM4/16/19
to LAStools - efficient tools for LiDAR processing
On a similar note, can this same laszip workflow work on e572las? Basically I have the exact same situation, but looking to convert e57 to laz in a directory. Trying this, but not having much luck:

dir *.e57 /b /s > temp.txt
e572las -lof temp.txt -olaz

Sam Hackett

unread,
Apr 17, 2019, 4:10:28 PM4/17/19
to LAStools - efficient tools for LiDAR processing
Hi,

I run the equivalent on xyzi text data to laz, I expect it does e57 just the same.


Sam

Reply all
Reply to author
Forward
0 new messages