remove_vlr in las2las

260 views
Skip to first unread message

Tobbe Helgesson

unread,
Jun 20, 2016, 10:48:23 AM6/20/16
to LAStools - efficient tools for LiDAR processing
Hi, Im trying to get a bat-file to open all .las-files and remove Variable Length Records (VLR) in header with the help of las2las.exe.
I could not get las2las to open the files remove vlr and save it again, had to make it do temp-files.

This is my current script:

@ECHO OFF
TITLE Remove VLR
FOR /r %%X IN (*.las) DO ( 
    ECHO Handling %%X
    las2las.exe %%X -remove_vlr 0 -o %%X.temp
    MOVE /Y "%%X.temp" "%%X"
)
pause


Problem is that the outcome somehow is .txt files and not .las anymore.
Anyone with tips for a beginner? :) 

// Tobbe

Kirk Waters - NOAA Federal

unread,
Jun 20, 2016, 11:07:24 AM6/20/16
to LAStools - efficient command line tools for LIDAR processing
Tobbe,
The problem is that las2las is determining your output type based on the file extension (.temp in this case). I'd suggest using a temp directory and making an output file with the same name as the input file. So, you'd have lines like:
las2las.exe %%X -remove_vlr 0 -o tempdir\%%X
move /Y "tempdir\%%X" "%%X"


Kirk Waters, PhD                     | NOAA Office for Coastal Management
Applied Sciences Program      | 2234 South Hobson Ave
843-740-1227                          | Charleston, SC 29405    

Nicolas Cadieux

unread,
Jun 20, 2016, 11:22:12 AM6/20/16
to last...@googlegroups.com

Hi,
Not sure but las2las probably needs a .las or .laz extension. Others "may" be interpreted as you trying to export as a text file (like if you are using las2txt).  I am speculating here. Try sending the results of the bat file in another directory using the .las extension.

Nicolas

--
Message has been deleted

Tobbe Helgesson

unread,
Jun 21, 2016, 8:24:46 AM6/21/16
to LAStools - efficient tools for LiDAR processing, nicolas...@archeotec.ca
Hi Nicolas!

Sending the file to another directory would work for me. How would the code for that command look like? Im so new to this.
At this moment i use this code:

@ECHO OFF
TITLE Remove VLR
FOR /r %%X IN (*.las) DO ( 
    ECHO Handling %%X
    las2las.exe %%X -remove_vlr 0 
)
pause

It removes the VLRs as it should but creating new las-files with the VLRs not overwriting current.
Can i add something here to make it go to a new directory and not make copies in the same directory so the name not change. 
Every file get a copy with the same name +"_1" in the end.

Regards, Tobbe

Martin Isenburg

unread,
Jun 21, 2016, 8:37:03 AM6/21/16
to LAStools - efficient command line tools for LIDAR processing
Hello Tobbe,

you will have to create this temporary directory first with 'mkdir' in order to have LAStools output to it. Rather than looping in your batch script you could simply use a wild-card such as:

mkdir temp
las2las -i *.las -remove_vlr 0 -odir temp

now you can also run on multiple cores:

las2las -i *.las -remove_vlr 0 -odir temp -cores 4

but using LAS you will quickly be I/O bound so to make really use of all your cores it may be better to use LAZ:

las2las -i *.laz -remove_vlr 0 -odir temp -olaz -cores 4

Regards,

Martin @rapidlasso

PS: Here the change in your script. See the 'example_batch_script' folder that is part of the LAStools.zip distribution for ideas how to write LAStools batch scripts ...

@ECHO OFF
TITLE Remove VLR
rmdir temp /s /q
mkdir temp
FOR /r %%X IN (*.las) DO ( 
    ECHO Handling %%X
    las2las.exe %%X -remove_vlr 0 -odir temp
)
pause
Reply all
Reply to author
Forward
0 new messages