Header with Multiple Lines

45 views
Skip to first unread message

Nick Statom

unread,
Mar 14, 2022, 11:50:50 AMMar 14
to LAStools - efficient tools for LiDAR processing
Hello,

I want to add a new VLR that contains a string with multiple lines to TEXT AREA DESCRIPTION in a LAS 1.4 file (User ID: LASF_Spec, Record ID: 3). I see that you can add a VLR using an updated LAS2LAS version: https://groups.google.com/g/lastools/c/vshy1EpzuxY?pli=1, but Windows command line does not allow for new line characters that I know of. 

For GeoTIFF I have done something similar with EXIFTOOL which allows for a formatted ascii text file to be imported in the command line ("-Description<=file.txt"). Is there something similar for LASTools? My workaround might be to just add a new VLR every time I want to use the new line in my text but may be a bit clunky.

Thanks,
Nick

Support at rapidlasso

unread,
Mar 16, 2022, 7:05:13 AMMar 16
to LAStools - efficient tools for LiDAR processing
Hi Nick,
this is more a DOS subject than LAStools.
First I want to ask if it makes sense to save multiline-texts within a VLR.
I do not think so.
LAS is not a database but a storage for LiDAR data.
It should rather be the other way round: Build a database. Store your LAS/LAZ files there.
Put all you have around also into the database.
But may you have a really good reason to save a multi-line-text within a LAS file.
Then this hints may help you:
  • You do not need a/this special version linked above. The feature is now in the reqular release.
  • Right now the text is cropped after the first CR/LF.
  • Right now we just save standard ASCII and no UTF-8,...
Because we crop you just have to replace your CR/LF into something else
and then restore the replacement when you get the data back.
If you have plain ASCII and just want to replace the CR/LF into something you
may be able to do this with some DOS commands.
If you have a real text or something else I would recommend to convert all
into a ASCII safe representation - e.g. a Base64 encoded string.
There are many tools around to help you with this.

If you like DOS you may become happy with this:

setlocal enabledelayedexpansion
rem put your multiline input into a dos var and replace all linebreaks with a \n sequence
set "line="
for /f "delims=" %%a in (multiline.txt) do set "line=!line!%%a\n"
echo %line%
rem put this line into the VLR, add a "##" before to simplify decoding
las2las -i test1.laz -o test2.laz -add_empty_vlr "test" 123 "##"%line%
las2las -i test2.laz -save_vlrs
type vlrs.vlr


Hope this helps,

Jochen @rapidlasso
Reply all
Reply to author
Forward
0 new messages