Extra Bytes error

28 views
Skip to first unread message

Dave Munge

unread,
Sep 15, 2025, 6:32:25 AMSep 15
to LAStools - efficient tools for LiDAR processing
Hello,

For years, I've been saving the relative z height to the ground with lasheight64 in my laz files, in an extrabyte. I then use las2dem with -attribute 0 as needed to generate a tif with this height relative to the ground, and everything always works fine. Currently, I have about a hundred tiles in a project that contains thousands of tiles for which it doesn't work! If I create a new tile by replacing the Z, everything works:

lasheight64.exe -i *.laz -olaz -drop_class 7 18 -replace_z
las2dem64.exe -i *.laz -kill 10 -otif -drop_class 7 18 -step 1 -no_kml

However, if I do the same thing but save the relative z in an extrabyte, the output is generated as a tif, but it contains some or all of the wrong values.

lasheight64.exe -i *.laz -olaz -store_as_extra_bytes -drop_class 7 18
las2dem64.exe -i *.laz -kill 10 -attribute 0 -otif -drop_class 7 18 -step 1 -no_kml

You can find the tiles and results as examples here:


Can someone explain how to fix this problem?

Thanks!

Jochen Rapidlasso

unread,
Sep 15, 2025, 7:21:19 AMSep 15
to LAStools - efficient tools for LiDAR processing
Hi Dave,
thanks for the detailed description of the problem and the test data.
First we have a look at your input file:

lasinfo64 -i "24_3125653f06_dc.laz"

LAStools lasinfo ...
...
  version major.minor:        1.4
...
  number of extended_variable length records: 1
...
variable length header record 1 of 4:
  reserved             0
  user ID              'LASF_Spec'
  record ID            4
  length after header  192
  description          'Extra Bytes Record'
    Extra Byte Descriptions
      data type: 0 (untyped bytes), size: 6
variable length header record 2 of 4: ...
variable length header record 3 of 4: ...
variable length header record 4 of 4: ...
extended variable length header record 1 of 1:
  reserved             0
  user ID              'LASF_Spec'
  record ID            4
  length after header  576
  description          'Extra Bytes Record'
LASzip compression (version 3.4r3 c3 50000): POINT14 3 BYTE14 3
reporting minimum and maximum for all LAS point record entries ...
...
  attribute0      11.62      11.62  ('Amplitude')
  attribute1      -2.97      -2.97  ('Reflectance')
  attribute2         24         24  ('Deviation')
...

It seems your data contains VLRs a EVLR and already some attributes 0..2.
It also seems, that this EVLR blocks the creation of attributes.

Simple solution is to avoid thie EVLR. We move this EVLR to a regular VLR:

las2las64 -i 24_3125653f06_dc.laz -o tmp1.laz -move_evlrs_to_vlrs
lasinfo64 -i tmp1.laz

This succeed, but for some reason, the number of VLRs remains 4 - so it seems, this EVLR is invalid.

Anyway, the move cleans up the file and removes the EVLR. Another option would be "-remove_all_evlrs".
Another issue is within your argument "-attribute 0". Because you do already have attributes set, you will get the wrong values using "-attribute 0".

Its better to use "-z_from_attribute" which will look for the suitable attribute:

las2dem64.exe -i tmp1.laz -kill 10 -otif -drop_class 7 18 -step 1 -no_kml -z_from_attribute -v

<<
autodetect extra_byte[3] as z
>>

This will autodetect the correct attribute/extra_byte and use this as height value.    

Hope this helps,
Cheers,

Jochen @rapidlasso

Dave Munge

unread,
Sep 15, 2025, 10:54:02 AMSep 15
to LAStools - efficient tools for LiDAR processing
Hi Jochen,

OK, thanks !

 

Yet I had already used the following command before:

 

las2las -i *.laz -rescale 0.01 0.01 0.01 -auto_reoffset -set_point_type 1 -set_point_size 28 -remove_all_vlrs...

 

Do I need to re-run it, or do I just need to use -z_from_attribute with las2dem and it will work correctly?

 

I'll give it a try, thanks!


Jochen Rapidlasso

unread,
Sep 15, 2025, 10:58:12 AMSep 15
to LAStools - efficient tools for LiDAR processing
Hi Dave,
a) you have to run also "-remove_all_evlrs" to remove the invalid EVLR.
b) remove the VLRs if you want
c) try to use las2las64 instead of las2las

Yes, give it a try!

Cheers,

Jochen @rapidlasso

Dave Munge

unread,
Sep 15, 2025, 4:07:33 PMSep 15
to LAStools - efficient tools for LiDAR processing
Okay, great, thanks, everything works!

It was really just that -remove_all_evlrs was missing. There was already a -remove_all_vlrs, but I didn't have this second level.
Thanks again!
Reply all
Reply to author
Forward
0 new messages