remove extra byte data

565 views
Skip to first unread message

Sam Hackett

unread,
May 15, 2018, 6:25:16 PM5/15/18
to LAStools - efficient tools for LiDAR processing
Hi,

I have LAS data that has come out of the back end of Height Above Ground calculations with the '-store_as_extra_bytes'.  It appears the extra bytes are messing up importing the LAS into another program.  Is there a command to remove the extra bytes?


Thanks

Sam


Martin Isenburg

unread,
May 15, 2018, 6:48:39 PM5/15/18
to LAStools - efficient command line tools for LIDAR processing
Hello,

I guess I should add this functionality. For the time being you can do the trick shown below. You need to know the point size without extra bytes (type 0 = 20 bytes, type 1 = 28 bytes, type 2 = 26 bytes, type 3 = 34 bytes, ...0) and you need to know the index of the VLR describing the extra bytes in the LAS header. 

Here the point size is 1 so I reset its size back down to 28. And here the VLR  describing the extra bytes  in the LAS header is the second one and it's index in the array of VLRs is 1.

:: adding extra bytes
lasheight -i ..\data\fusa.laz ^
               -classify_above 7.5 8 ^
               -store_as_extra_bytes ^
               -o fusa_extra.laz

:: removing extra bytes and description
las2las -i fusa_extra.laz ^
            -set_point_size 28 ^
            -remove_vlr 1 ^
            -o fusa_noextra.laz

:: relevant lasinfo reports

e:\LAStools\bin>lasinfo -i ..\data\fusa.laz
lasinfo (180429) report for '..\data\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 Martin Isenburg'
  generating software:        'lasclassify (110920) unlicensed'
  file creation day/year:     40/2010
  header size:                227
  offset to point data:       321
  number var. length records: 1
  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 1:
  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
LASzip compression (version 2.0r1 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)

=========================

e:\LAStools\bin>lasinfo -i fusa_extra.laz
lasinfo (180429) report for 'fusa_extra.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:        'lasheight (180429) commercial'
  file creation day/year:     40/2010
  header size:                227
  offset to point data:       567
  number var. length records: 2
  point data format:          1
  point data record length:   30
  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              'LASF_Spec'
  record ID            4
  length after header  192
  description          'by LAStools of rapidlasso GmbH'
    Extra Byte Descriptions
      data type: 4 (short), name "height above ground", description: "vertical point to TIN distance", scale: 0.01, offset: 250
LASzip compression (version 3.2r3 c2 50000): POINT10 2 GPSTIME11 2 BYTE 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          8
  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:
           17131  unclassified (1)
          180868  ground (2)
           31803  high vegetation (5)
           32255  building (6)
           15516  keypoint (8)

=========================

e:\LAStools\bin>lasinfo -i fusa_noextra.laz
lasinfo (180429) report for 'fusa_noextra.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 180512)'
  file creation day/year:     40/2010
  header size:                227
  offset to point data:       321
  number var. length records: 1
  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 1:
  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
LASzip compression (version 3.2r3 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          8
  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:
           17131  unclassified (1)
          180868  ground (2)
           31803  high vegetation (5)
           32255  building (6)
           15516  keypoint (8)


Sam Hackett

unread,
May 15, 2018, 7:43:06 PM5/15/18
to LAStools - efficient tools for LiDAR processing
Thanks Martin,

Empowered with that knowledge I'm sure I can sort that.
For my data;
point data format = 1
point data record length = 30 (so this will be reduced to 28)
VLR record is 2 of 2

so I will use;
-set_point_size 28 ^
-remove_vlr 2 ^


Thanks for the quick response... you're not on an aircraft bound for a tropical paradise for a change ;-)



lasinfo (180303) report for Class3.las

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.3

  system identifier
:          'LAStools (c) by rapidlasso GmbH'

  generating software
:        'las2las (version 180303)'
  file creation day
/year:     236/2017
  header size
:                235
  offset to point data
:       575

  number
var. length records: 2
  point data format
:          1
  point data record length
:   30

  number of point records
:    2081788
  number of points
by return: 1803175 185176 56434 23521 8824

  scale factor x y z
:         0.01 0.01 0.01

  offset x y z
:               400000 700000 0
  min x y z
:                  409852.80 767980.32 5.21
  max x y z
:                  413251.83 772343.40 87.11
  start of waveform data packet record
: 0

variable length header record
1 of 2:

  reserved            
0

  user ID              
'LASF_Projection'
  record ID            
34735
  length after header  
40

  description          
'by LAStools of rapidlasso GmbH'

   
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 2105 - ProjectedCSTypeGeoKey: NZGD2000 / Mount Eden 2000

      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              
'LASF_Spec'
  record ID            
4
  length after header  
192
  description          
'by LAStools of rapidlasso GmbH'
   
Extra Byte Descriptions
      data type
: 4 (short), name "height above ground", description: "vertical point to TIN distance", scale: 0.01, offset: 250

reporting minimum
and maximum for all LAS point record entries ...

  X              
985280    1325183
  Y            
6798032    7234340
  Z                
521       8711
  intensity        
418      65535
  return_number      
1          7
  number_of_returns  
1          7

  edge_of_flight_line
0          0
  scan_direction_flag
0          0

  classification      
3          3
  scan_angle_rank  
-29         16
  user_data          
1          2
  point_source_ID  
1107       1716
  gps_time
168586574.201361 170381688.662964
number of first returns
:        1803175
number of intermediate returns
: 520
number of
last returns:         2080392
number of single returns
:       1802299
WARNING
: there are 3190 points with return number 6
WARNING
: there are 1468 points with return number 7
overview over number of returns of given pulse
: 1802299 185317 56755 23722 8943 3246 1506

histogram of classification of points
:

         
2081788  low vegetation (3)

Martin Isenburg

unread,
May 15, 2018, 7:46:43 PM5/15/18
to LAStools - efficient command line tools for LIDAR processing
Hello,

Common miss-conception. The second VLR (2 of 2) has index 1 in the C/C++ style array of VLRs. Hence its '-remove_vlr 1' just like in my example.

Regards,

Martin

Reply all
Reply to author
Forward
0 new messages