Edit / create variable length headers

406 views
Skip to first unread message

andrewj...@gmail.com

unread,
May 13, 2017, 11:31:24 PM5/13/17
to LAStools - efficient tools for LiDAR processing
Is there a way to edit and / or create variable length headers?  Header 1 has my projection information, and headers 2 through 6 contain standardized (?) as well as unique information required by my customer.  The LAS file coming out of TerraScan has no variable length header, but  we have been running an old  compiled executable to populate headers.  Now, we have changed platform(s), executable is incorrect, and customer still wants unique header info.   I have looked at help and tried lasinfo, and las2las with no luck.  I am using LibLas with las 1.2 on Windows 7, and have  GIS available (Arc, OSGeo/Qgis).  Thanks for any help  Below is a snippet of some of the header.

variable length header record 1 of 6:
  reserved             43707
  user ID              'LASF_Projection'
  record ID            34735
  length after header  48
  description          'GeoTIFF MetaData Tags'
    GeoKeyDirectoryTag version 1.1.0 number of keys 5
      key 1024 tiff_tag_location 0 count 1 value_offset 1 - GTModelTypeGeoKey: ModelTypeProjected
      key 3072 tiff_tag_location 0 count 1 value_offset 32611 - ProjectedCSTypeGeoKey: WGS 84 / UTM 11N
      key 3076 tiff_tag_location 0 count 1 value_offset 9001 - ProjLinearUnitsGeoKey: Linear_Meter
      key 4096 tiff_tag_location 0 count 1 value_offset 5030 - VerticalCSTypeGeoKey: VertCS_WGS_84_ellipsoid
      key 4099 tiff_tag_location 0 count 1 value_offset 9001 - VerticalUnitsGeoKey: Linear_Meter
variable length header record 2 of 6:
  reserved             43707
  user ID              'LASF_Projection'
  record ID            34736
  length after header  40
  description          'GeoTIFF MetaData Tags'
    GeoDoubleParamsTag (number of doubles 5)
      0 0 0 0 0 
variable length header record 3 of 6:
  reserved             43707
  user ID              'LASF_Projection'
  record ID            34737
  length after header  256
  description          'GeoTIFF MetaData Tags'
    GeoAsciiParamsTag (number of characters 256)
                                                                                                                                                                                                                                                                      
variable length header record 4 of 6:
  reserved             43707
............

Martin Isenburg

unread,
May 13, 2017, 11:48:38 PM5/13/17
to LAStools - efficient command line tools for LIDAR processing
Hello,

Could you send us two complete lasinfo reports? One for the LAS file with the desired VLRs and one for the LAS file that does not have any VLRs and I think I may have a solution for you.

Regards,

Martin @rapidlasso

andrewj...@gmail.com

unread,
May 15, 2017, 12:37:36 PM5/15/17
to LAStools - efficient tools for LiDAR processing
Here is the lasinfo prior to the headers being created/populated:

reporting all LAS header entries:
  file signature:             'LASF'
  file source ID:             0
  global_encoding:            1
  project ID GUID data 1-4:   00000000-0000-0000-0000-000000000000
  version major.minor:        1.2
  system identifier:          ''
  generating software:        'TerraScan'
  file creation day/year:     132/2017
  header size:                227
  offset to point data:       229
  number var. length records: 0
  point data format:          1
  point data record length:   28
  number of point records:    151621719
  number of points by return: 151621719 0 0 0 0
  scale factor x y z:         0.01 0.01 0.01
  offset x y z:               0 0 0
  min x y z:                  737980.01 3459980.00 -412.67
  max x y z:                  748020.00 3470019.99 484.87
the header is followed by 2 user-defined bytes
reporting minimum and maximum for all LAS point record entries ...
  X            73798001   74802000
  Y           345998000  347001999
  Z              -41267      48487
  intensity           4       5100
  return_number       1          1
  number_of_returns   1          4
  edge_of_flight_line 0          1
  scan_direction_flag 0          1
  classification     11         11
  scan_angle_rank    -5          5
  user_data           0          0
  point_source_ID   102        216
  gps_time 109406661.606225 109673439.940615
number of first returns:        151621719
number of intermediate returns: 0
number of last returns:         150911743
number of single returns:       150911743
overview over number of returns of given pulse: 150911743 696650 13162 164 0 0 0
histogram of classification of points:
       151621719  road surface (11)

and here is the lasinfo after the headers are created and populated:

reporting all LAS header entries:
  file signature:             'LASF'
  file source ID:             0
  global_encoding:            1
  project ID GUID data 1-4:   00000000-0000-0000-0000-000000000000
  version major.minor:        1.2
  system identifier:          'CustomerName Optech ALTM Gemini'
  generating software:        'TerraScan'
  file creation day/year:     65/2015
  header size:                227
  offset to point data:       1308
  number var. length records: 6
  point data format:          1
  point data record length:   28
  number of point records:    151621719
  number of points by return: 151621719 0 0 0 0
  scale factor x y z:         0.01 0.01 0.01
  offset x y z:               0 0 0
  min x y z:                  737980.01 3459980.00 -412.67
  max x y z:                  748020.00 3470019.99 484.87
variable length header record 1 of 6:
  reserved             43707
  user ID              'LASF_Projection'
  record ID            34735
  length after header  48
  description          'GeoTIFF MetaData Tags'
    GeoKeyDirectoryTag version 1.1.0 number of keys 5
      key 1024 tiff_tag_location 0 count 1 value_offset 1 - GTModelTypeGeoKey: ModelTypeProjected
      key 3072 tiff_tag_location 0 count 1 value_offset 32636 - ProjectedCSTypeGeoKey: WGS 84 / UTM 36N
      key 3076 tiff_tag_location 0 count 1 value_offset 9001 - ProjLinearUnitsGeoKey: Linear_Meter
      key 4096 tiff_tag_location 0 count 1 value_offset 5030 - VerticalCSTypeGeoKey: VertCS_WGS_84_ellipsoid
      key 4099 tiff_tag_location 0 count 1 value_offset 9001 - VerticalUnitsGeoKey: Linear_Meter
variable length header record 2 of 6:
  reserved             43707
  user ID              'LASF_Projection'
  record ID            34736
  length after header  40
  description          'GeoTIFF MetaData Tags'
    GeoDoubleParamsTag (number of doubles 5)
      0 0 0 0 0 
variable length header record 3 of 6:
  reserved             43707
  user ID              'LASF_Projection'
  record ID            34737
  length after header  256
  description          'GeoTIFF MetaData Tags'
    GeoAsciiParamsTag (number of characters 256)
                                                                                                                                                                                                                                                                      
variable length header record 4 of 6:
  reserved             43707
  user ID              'CustomerName'
  record ID            2
  length after header  131
  description          'Disclosure'
variable length header record 5 of 6:
  reserved             43707
  user ID              'CustomerName'
  record ID            3
  length after header  124
  description          'Tasking'
variable length header record 6 of 6:
  reserved             43707
  user ID              'CustomerName'
  record ID            4
  length after header  156
  description          'Collection'
the header is followed by 2 user-defined bytes
reporting minimum and maximum for all LAS point record entries ...
  X            73798001   74802000
  Y           345998000  347001999
  Z              -41267      48487
  intensity           4       5100
  return_number       1          1
  number_of_returns   1          4
  edge_of_flight_line 0          1
  scan_direction_flag 0          1
  classification     11         11
  scan_angle_rank    -5          5
  user_data           0          0
  point_source_ID   102        216
  gps_time 109406661.606225 109673439.940615
number of first returns:        151621719
number of intermediate returns: 0
number of last returns:         150911743
number of single returns:       150911743
overview over number of returns of given pulse: 150911743 696650 13162 164 0 0 0
histogram of classification of points:
       151621719  road surface (11)

Any help on how to create/modify these headers would be great.  Again, our tool (.exe) works with old platform, but platform has changed.  

Martin Isenburg

unread,
May 15, 2017, 10:32:12 PM5/15/17
to LAStools - efficient command line tools for LIDAR processing
Hello,

here how to do this. First I create my own example without any VLRs. This removes the two VLRs from 'sample.laz' and creates the file that I want to add VLRs to later.

las2las -i ..\data\sample.laz ^
            -remove_all_vlrs ^
            -o lidar_no_vlr.laz

Now the file 'sample.laz' has the VLRs that I want to keep. Ideally it also has the same point type and scale / offset as my file without VLRs. I simply remove all points from this file using some filter which is guaranteed to remove all points.

las2las -i ..\data\sample.laz ^
            -keep_synthetic -drop_synthetic ^
            -o lidar_no_points.laz

or

las2las -i ..\data\sample.laz ^
            -keep_z_above 1000000 ^
            -o lidar_no_points.laz

Now we merge the empty file that has the VLRs with the file that has the points. Note that the order is important as the header of the *first* file is used for the merged file.

lasmerge -i lidar_no_points.laz ^
                -i lidar_no_vlr.laz ^
                -o lidar_with_vlrs.laz

And yes, I got all the points.

lasview -i lidar_with_vlrs.laz

And yes, I got also my two VLRs. The same sequence of commands should work for you as well.

lasinfo -i lidar_with_vlrs.laz
lasinfo (170511) report for lidar_with_vlrs.laz
reporting all LAS header entries:
  file signature:             'LASF'
  file source ID:             0
  global_encoding:            1
  project ID GUID data 1-4:   00000000-0000-0000-0000-000000000000
  version major.minor:        1.2
  system identifier:          'LAStools (c) by rapidlasso GmbH'
  generating software:        'lasmerge (version 170511)'
  file creation day/year:     0/0
  header size:                227
  offset to point data:       473
  number var. length records: 2
  point data format:          1
  point data record length:   28
  number of point records:    150395
  number of points by return: 106930 35816 6928 690 30
  scale factor x y z:         0.01 0.01 0.01
  offset x y z:               0 0 0
  min x y z:                  278200.00 602200.00 93.34
  max x y z:                  278299.99 602299.99 123.10
variable length header record 1 of 2:
  reserved             43707
  user ID              'LASF_Projection'
  record ID            34735
  length after header  96
  description          'by LAStools of Martin Isenburg'
    GeoKeyDirectoryTag version 1.1.0 number of keys 11
      key 1024 tiff_tag_location 0 count 1 value_offset 1 - GTModelTypeGeoKey: ModelTypeProjected
      key 3072 tiff_tag_location 0 count 1 value_offset 32767 - ProjectedCSTypeGeoKey: user-defined
      key 3075 tiff_tag_location 0 count 1 value_offset 1 - ProjCoordTransGeoKey: CT_TransverseMercator
      key 3076 tiff_tag_location 0 count 1 value_offset 9001 - ProjLinearUnitsGeoKey: Linear_Meter
      key 3088 tiff_tag_location 34736 count 1 value_offset 0 - ProjCenterLongGeoKey: 19
      key 3081 tiff_tag_location 34736 count 1 value_offset 1 - ProjNatOriginLatGeoKey: 0
      key 3092 tiff_tag_location 34736 count 1 value_offset 2 - ProjScaleAtNatOriginGeoKey: 0.9993
      key 3082 tiff_tag_location 34736 count 1 value_offset 3 - ProjFalseEastingGeoKey: 500000
      key 3083 tiff_tag_location 34736 count 1 value_offset 4 - ProjFalseNorthingGeoKey: -5300000
      key 2056 tiff_tag_location 0 count 1 value_offset 7019 - GeogEllipsoidGeoKey: Ellipse_GRS_1980
      key 4099 tiff_tag_location 0 count 1 value_offset 9001 - VerticalUnitsGeoKey: Linear_Meter
variable length header record 2 of 2:
  reserved             43707
  user ID              'LASF_Projection'
  record ID            34736
  length after header  40
  description          'by LAStools of Martin Isenburg'
    GeoDoubleParamsTag (number of doubles 5)
      19 0 0.9993 500000 -5.3e+006
the header is followed by 2 user-defined bytes
LASzip compression (version 3.0r0 c2 50000): POINT10 2 GPSTIME11 2
reporting minimum and maximum for all LAS point record entries ...
  X            27820000   27829999
  Y            60220000   60229999
  Z                9334      12310
  intensity          10        276
  return_number       1          6
  number_of_returns   1          6
  edge_of_flight_line 0          1
  scan_direction_flag 0          0
  classification      0          0
  scan_angle_rank   -29         22
  user_data           0          0
  point_source_ID    49         51
  gps_time 987558.410492 989903.877288
number of first returns:        106930
number of intermediate returns: 7673
number of last returns:         107096
number of single returns:       71304
WARNING: there is 1 point with return number 6
overview over number of returns of given pulse: 71304 57541 18730 2668 146 6 0
histogram of classification of points:
          150395  never classified (0)

Regards,

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