Add new VLR or Comment

343 views
Skip to first unread message

WickedGardener

unread,
Jan 14, 2021, 12:36:38 PM1/14/21
to LAStools - efficient tools for LiDAR processing

I'd like to know if or how I could add my own custom VLR to a las file using LASTOOLS. Actually all I'd like to do is put a "comment" such as "this file contains data collected on 12 Dec 2020" or something similar. Can I do that? Do I even need to use a VLR?

I was thinking to use a VLR. For example:
variable length header record 2 of 2:
  reserved             0
  user ID              'Origin'
  record ID            101
  length after header  24
  description          'TopoDOT Scanner Origin'

but change user ID to "Collection date"
and description to "12 Dec 2020"

Thanks.

Martin Isenburg

unread,
Jan 14, 2021, 3:18:12 PM1/14/21
to LAStools - efficient command line tools for LIDAR processing
Hello,

if you already have a VLR in place and you just want to change it's name or description you can use lasinfo with one of these options and do it in place:

-set_vlr_record_id 2 4711
-set_vlr_user_id 1 "hello martin"
-set_vlr_description 0 "hello martin"

http://rapidlasso.com/lasinfo  

if you need to add a new empty VLR you need to download this new version:of las2las:

https://www.dropbox.com/s/ere9wpz87rkirmx/las2las.exe

here you have this new option

-add_empty_vlr "hello martin" 4711 "i like laser chickens"  

http://rapidlasso.com/las2las 

Here an example run:

E:\software\LAStools\bin>las2las -i ..\data\fusa.laz -add_empty_vlr "hello martin" 4711 "i like laser chickens" -o fusa.laz

E:\software\LAStools\bin>lasinfo fusa.laz
lasinfo (201224) report for 'fusa.laz'
reporting all LAS header entries:
  file signature:             'LASF'
  file source ID:             0
  global_encoding:            0
  project ID GUID data 1-4:   00000000-0000-0000-0000-000000000000
  version major.minor:        1.1
  system identifier:          'LAStools (c) by rapidlasso GmbH'
  generating software:        'las2las (version 210114)'
  file creation day/year:     40/2010
  header size:                227
  offset to point data:       375
  number var. length records: 2
  point data format:          1
  point data record length:   28
  number of point records:    277573
  number of points by return: 263413 13879 281 0 0
  scale factor x y z:         0.01 0.01 0.01
  offset x y z:               0 0 0
  min x y z:                  277750.00 6122250.00 42.21
  max x y z:                  277999.99 6122499.99 64.35
variable length header record 1 of 2:
  reserved             43707
  user ID              'LASF_Projection'
  record ID            34735
  length after header  40
  description          'by LAStools of Martin Isenburg'
    GeoKeyDirectoryTag version 1.1.0 number of keys 4
      key 1024 tiff_tag_location 0 count 1 value_offset 1 - GTModelTypeGeoKey: ModelTypeProjected
      key 3072 tiff_tag_location 0 count 1 value_offset 32754 - ProjectedCSTypeGeoKey: WGS 84 / UTM 54S
      key 3076 tiff_tag_location 0 count 1 value_offset 9001 - ProjLinearUnitsGeoKey: Linear_Meter
      key 4099 tiff_tag_location 0 count 1 value_offset 9001 - VerticalUnitsGeoKey: Linear_Meter

variable length header record 2 of 2:
  reserved             0
  user ID              'hello martin'
  record ID            4711
  length after header  0
  description          'i like laser chickens'
LASzip compression (version 3.4r3 c2 50000): POINT10 2 GPSTIME11 2
reporting minimum and maximum for all LAS point record entries ...
  X            27775000   27799999
  Y           612225000  612249999
  Z                4221       6435
  intensity          10      62293
  return_number       1          3
  number_of_returns   1          3
  edge_of_flight_line 0          0
  scan_direction_flag 0          0
  classification      1          6
  scan_angle_rank    79        103
  user_data           0        197
  point_source_ID     1          1
  gps_time 5880.963028 5886.739738
number of first returns:        263413
number of intermediate returns: 283
number of last returns:         263370
number of single returns:       249493
overview over number of returns of given pulse: 249493 27232 848 0 0 0 0
histogram of classification of points:
           17553  unclassified (1)
          180868  ground (2)
           37030  high vegetation (5)
           42122  building (6)





--
Download LAStools at
http://lastools.org
http://rapidlasso.com
Be social with LAStools at
http://facebook.com/LAStools
http://twitter.com/LAStools
http://linkedin.com/groups/LAStools-4408378
Manage your settings at
http://groups.google.com/group/lastools/subscribe
---
You received this message because you are subscribed to the Google Groups "LAStools - efficient tools for LiDAR processing" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lastools+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lastools/baea5087-3cd7-44b4-a2ae-c01568d0a448n%40googlegroups.com.

Eric Putman

unread,
Jan 15, 2021, 7:27:13 PM1/15/21
to LAStools - efficient tools for LiDAR processing
This is a great new capability. Thanks, Martin.

WickedGardener

unread,
Jan 16, 2021, 1:14:50 PM1/16/21
to last...@googlegroups.com
Thank you Martin. This works great. It looks like there is a limit on 31 characters to the "description" field. Is there a way to change this? Also, is there a good online spec for VLRs in general? I'm just now learning about them.

Thanks Again!

You received this message because you are subscribed to a topic in the Google Groups "LAStools - efficient tools for LiDAR processing" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/lastools/vshy1EpzuxY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to lastools+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lastools/CABSWR-FGy8WbvMav9U%2BzMP4oVFf9KH%2BO8b6%2BoQMCjZoAPbPSxQ%40mail.gmail.com.

Eric Putman

unread,
Jun 13, 2024, 2:24:54 AMJun 13
to LAStools - efficient tools for LiDAR processing
Hello Jochen,

I was wondering if this functionality could please be expanded to include the capability of adding a "non-empty" VLR?

With the current "-add_empty_vlr" call, it seems like the user can add a VLR with a customized user ID, record ID, and description, but this VLR is empty and it doesn't seem like there is a way to insert a VLR with an actual payload of data. As mentioned above, the "description" field is limited in length which makes it difficult to use for storing desired information in a VLR. I think there could be many reasons to do so, but my main use case at the moment would be to add more detailed datum descriptions for certain localized/custom geodetic networks that aren't described by "normal" EPSG codes or standard WKT strings. I can send an example file if that's helpful, but hopefully my description makes sense.

Thank you and long may LAZ reign!

R,
Eric

Jochen Rapidlasso

unread,
Jun 13, 2024, 2:55:52 AMJun 13
to LAStools - efficient tools for LiDAR processing
Hi Eric,
thanks for your suggestion. This is a good idea, to make the VLR handling more powerfull. We will put this on the todo-list.
Just as an idea: Right now you could use las2las64 with the argument -save_vlrs to extract VLRs to a file, you can patch this file and put it back using -load_vlrs.
First byte saved is the number of VLRs, then for each VLR you have to set the field "record_length_after_header" to the size of your binary data.
Please see the save_vlrs method to see the file structure in detail.

Best,

Jochen @rapidlasso

Jochen Rapidlasso

unread,
Jul 10, 2024, 3:56:49 AMJul 10
to LAStools - efficient tools for LiDAR processing
Hi Eric,
we implemented the option to export and import single VLR entries:

-save_vlr [i] [u] [r] [f]           : saves a single VLR specified by index [i] (default = 0) or user ID [u] and record ID [r] to the file [f] (default: save.vlr) so it can be loaded into another file header
-load_vlr [i] [u] [r] [f]           : loads a single VLR specified by index [i] (default = 0) or user ID [u] and record ID [r] from the file [f] (default: save.vlr) and adds it to each processed file header

You can test this change on this beta version:

This change will be included in the next release unless we announce otherwise.

Cheers,

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