Extract the "raw_classification" flag with las2txt

51 views
Skip to first unread message

Ivelin Angelov

unread,
Jun 13, 2018, 2:34:54 PM6/13/18
to LAStools - efficient tools for LiDAR processing
I am trying to export the value of "raw_classification" from a las file to a CSV file. There is an option "c" for "-parse" to export the classification but in my las files, there is a filed "raw_classification" that has a different value. 

I already submitted a support ticket at the github repository: https://github.com/LAStools/LAStools/issues/53 and got an advice that this could be achieved via the option h - withheld flag, k - keypoint flag, g - synthetic flag. Unfortunately, I was not able to extract the needed field.

Here is a sample laz file (7MB) that contains classification and raw_classification fields. I am also attaching a csv file with the classification and raw_classification fields inside the sample laz file. My goal is to use las2txt and extract the two fields in a text file. Any help or advice will be much appreciated.

Thank you.

Martin Isenburg

unread,
Jun 26, 2018, 3:08:07 AM6/26/18
to LAStools - efficient command line tools for LIDAR processing
Hello,

you will have to download the latest version of LAStools (as I found a small bug in the library when I developed the workflow below that can extract those "ancient" or "raw" 8 bit classification codes that were allowed in the initial 1.0 version of LAS but changed later to 5 bit classification codes.


Just follow the steps below with the 180620 version ... 

E:\LAStools\bin>las2las -version
LAStools (by mar...@rapidlasso.com) version 180620

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

E:\LAStools\bin>lasinfo -i sample.laz
lasinfo (180620) report for 'sample.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:          ''
  generating software:        'LASzip DLL 2.4 r0 (150731)'
  file creation day/year:     151/2018
  header size:                227
  offset to point data:       227
  number var. length records: 0
  point data format:          1
  point data record length:   28
  number of point records:    1705564
  number of points by return: 1300757 275927 95278 27228 5475
  scale factor x y z:         0.01 0.01 0.01
  offset x y z:               0 0 0
  min x y z:                  6335725.72 1936317.47 1376.31
  max x y z:                  6336252.96 1936998.07 1760.36
LASzip compression (version 2.4r0 c2 50000): POINT10 2 GPSTIME11 2
reporting minimum and maximum for all LAS point record entries ...
  X           633572572  633625296
  Y           193631747  193699807
  Z              137631     176036
  intensity           1      23546
  return_number       0          7
  number_of_returns   0          7
  edge_of_flight_line 0          0
  scan_direction_flag 0          0
  classification      1         25
  scan_angle_rank   -29         29
  user_data           0          0
  point_source_ID  5625       5625
  gps_time 199138704.649335 199138714.407946
number of first returns:        1300757
number of intermediate returns: 128855
number of last returns:         1300787
number of single returns:       1024865
WARNING: for return 1 real number of points by return (1300752) is different from header entry (1300757).
WARNING: there are 5 points with return number 0
WARNING: there are 805 points with return number 6
WARNING: there are 94 points with return number 7
overview over number of returns of given pulse: 1024825 361298 204150 87012 23350 4266 623
WARNING: there are 40 points with a number of returns of given pulse of 0
histogram of classification of points:
         1701789  unclassified (1)
            1381  rail (10)
             463  Reserved for ASPRS Definition (21)
            1931  Reserved for ASPRS Definition (25)
 +-> flagged as withheld:  2394

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

E:\LAStools\bin>las2las -i sample.laz -set_point_type 6 -o sample_pt6.laz

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

E:\LAStools\bin>lasinfo -i sample_pt6.laz
lasinfo (180620) report for 'sample_pt6.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.4
  system identifier:          'LAStools (c) by rapidlasso GmbH'
  generating software:        'las2las (version 180620)'
  file creation day/year:     151/2018
  header size:                375
  offset to point data:       375
  number var. length records: 0
  point data format:          6
  point data record length:   30
  number of point records:    0
  number of points by return: 0 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:                  6335725.72 1936317.47 1376.31
  max x y z:                  6336252.96 1936998.07 1760.36
  start of waveform data packet record: 0
  start of first extended variable length record: 0
  number of extended_variable length records: 0
  extended number of point records: 1705564
  extended number of points by return: 1300752 275927 95278 27228 5475 805 94 0 0 0 0 0 0 0 0
LASzip compression (version 3.2r4 c3 50000): POINT14 3
reporting minimum and maximum for all LAS point record entries ...
  X           633572572  633625296
  Y           193631747  193699807
  Z              137631     176036
  intensity           1      23546
  return_number       0          7
  number_of_returns   0          7
  edge_of_flight_line 0          0
  scan_direction_flag 0          0
  classification      1         25
  scan_angle_rank   -29         29
  user_data           0          0
  point_source_ID  5625       5625
  gps_time 199138704.649335 199138714.407946
  extended_return_number          0      7
  extended_number_of_returns      0      7
  extended_classification         1     25
  extended_scan_angle         -4833   4833
  extended_scanner_channel        0      0
number of first returns:        1300757
number of intermediate returns: 128855
number of last returns:         1300787
number of single returns:       1024865
WARNING: there are 5 points with return number 0
overview over extended number of returns of given pulse: 1024825 361298 204150 87012 23350 4266 623 0 0 0 0 0 0 0 0
WARNING: there are 40 points with a number of returns of given pulse of 0
histogram of classification of points:
         1701789  unclassified (1)
            1381  rail (10)
             463  Reserved for ASPRS Definition (21)
            1931  Reserved for ASPRS Definition (25)
 +-> flagged as withheld:  2394

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

E:\LAStools\bin>las2las -i sample_pt6.laz -move_ancient_to_extended_classification -o sample_pt6_moved.laz

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

E:\LAStools\bin>lasinfo -i sample_pt6_moved.laz
lasinfo (180620) report for 'sample_pt6_moved.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.4
  system identifier:          'LAStools (c) by rapidlasso GmbH'
  generating software:        'las2las (version 180620)'
  file creation day/year:     151/2018
  header size:                375
  offset to point data:       375
  number var. length records: 0
  point data format:          6
  point data record length:   30
  number of point records:    0
  number of points by return: 0 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:                  6335725.72 1936317.47 1376.31
  max x y z:                  6336252.96 1936998.07 1760.36
  start of waveform data packet record: 0
  start of first extended variable length record: 0
  number of extended_variable length records: 0
  extended number of point records: 1705564
  extended number of points by return: 1300752 275927 95278 27228 5475 805 94 0 0 0 0 0 0 0 0
LASzip compression (version 3.2r4 c3 50000): POINT14 3
reporting minimum and maximum for all LAS point record entries ...
  X           633572572  633625296
  Y           193631747  193699807
  Z              137631     176036
  intensity           1      23546
  return_number       0          7
  number_of_returns   0          7
  edge_of_flight_line 0          0
  scan_direction_flag 0          0
  classification      1         10
  scan_angle_rank   -29         29
  user_data           0          0
  point_source_ID  5625       5625
  gps_time 199138704.649335 199138714.407946
  extended_return_number          0      7
  extended_number_of_returns      0      7
  extended_classification         1    153
  extended_scan_angle         -4833   4833
  extended_scanner_channel        0      0
number of first returns:        1300757
number of intermediate returns: 128855
number of last returns:         1300787
number of single returns:       1024865
WARNING: there are 5 points with return number 0
overview over extended number of returns of given pulse: 1024825 361298 204150 87012 23350 4266 623 0 0 0 0 0 0 0 0
WARNING: there are 40 points with a number of returns of given pulse of 0
histogram of classification of points:
         1701789  unclassified (1)
            1381  rail (10)
histogram of extended classification of points:
             463  extended classification (149)
            1931  extended classification (153)

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

E:\LAStools\bin>las2txt -i sample_pt6_moved.laz -keep_extended_class 149 153 -parse txyznrc -stdout | more
199138705.596634 6335834.67 1936763.95 1415.65 3 2 149
199138705.604133 6335834.94 1936763.82 1416.17 2 1 149
199138705.611632 6335835.49 1936763.58 1416.76 3 2 149
199138705.619133 6335835.79 1936763.42 1417.35 2 1 149
199138705.641627 6335836.80 1936763.54 1418.37 2 1 149
199138705.664126 6335837.79 1936763.14 1419.85 2 1 149
199138705.671625 6335838.31 1936763.07 1420.27 2 1 149
199138705.694123 6335839.36 1936762.57 1421.98 3 1 149
199138705.709121 6335839.98 1936762.37 1422.86 3 1 149
199138705.724117 6335840.70 1936762.46 1423.62 3 1 149
199138705.731617 6335841.13 1936762.20 1424.21 3 1 149
199138705.986598 6335854.20 1936758.53 1437.73 2 1 153
199138705.994097 6335854.62 1936758.39 1437.53 2 1 153
199138706.039102 6335858.00 1936757.45 1437.10 2 1 153
199138706.069106 6335860.12 1936756.84 1436.78 2 1 153
199138706.091607 6335861.80 1936756.34 1436.41 2 1 153
199138706.099108 6335862.29 1936756.17 1436.35 2 1 153
199138706.106610 6335862.68 1936756.14 1436.35 2 1 153
199138706.114105 6335863.11 1936756.33 1436.68 2 1 153
199138706.114110 6335863.20 1936755.97 1436.18 2 1 153
199138706.121609 6335863.86 1936755.80 1436.22 2 1 153
199138706.151613 6335865.95 1936755.16 1435.86 2 1 153
199138706.159113 6335866.64 1936755.02 1435.86 2 1 153
199138706.166614 6335867.17 1936754.86 1435.76 2 1 153
199138706.181614 6335868.02 1936754.78 1435.69 2 1 153
199138706.189115 6335868.58 1936754.71 1435.73 2 1 153
199138706.219119 6335870.74 1936753.94 1435.40 2 1 153
199138706.249120 6335872.93 1936753.34 1435.14 2 1 153
199138706.256622 6335873.33 1936753.14 1435.04 2 1 153
[...]
Reply all
Reply to author
Forward
0 new messages