What happens to classification with large class numbers?

372 views
Skip to first unread message

Paula Litkey

unread,
Jan 30, 2015, 6:26:42 AM1/30/15
to last...@googlegroups.com
Hei all,

Asprs LAS definition says class numbers 64-255 are user definable. (19-63 are reserved). We have data in which classes in that range are not read ok, but mapped to other classes. Everything larger than 31 seems to return to [0 31]. How can we get our user defined classes?

example with LAStools house data:

C:\Users\pli\lastools\lastools\bin>las2las -i C:\Users\pli\lastools\lastools\dat
a\house.laz -o C:\Users\pli\house2.laz -set_classification 240

C:\Users\pli\lastools\lastools\bin>lasinfo -i C:\Users\pli\house2.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.2
  system identifier:          'LAStools (c) by Martin Isenburg'
  generating software:        'las2las (version 140113)'
  file creation day/year:     151/2012
  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:    57084
  number of points by return: 37047 12918 5615 1299 191
  scale factor x y z:         0.01 0.01 0.01
  offset x y z:               0 0 0
  min x y z:                  309227.00 6143455.00 451.40
  max x y z:                  309268.99 6143496.99 471.39
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: M
odelTypeProjected
      key 3072 tiff_tag_location 0 count 1 value_offset 32755 - ProjectedCSTypeG
eoKey: PCS_WGS84_UTM_zone_55S
      key 3076 tiff_tag_location 0 count 1 value_offset 9001 - ProjLinearUnitsGe
oKey: Linear_Meter
      key 4099 tiff_tag_location 0 count 1 value_offset 9001 - VerticalUnitsGeoK
ey: Linear_Meter
LASzip compression (version 2.2r0 c2 50000): POINT10 2 GPSTIME11 2
reporting minimum and maximum for all LAS point record entries ...
  X   30922700   30926899
  Y  614345500  614349699
  Z      45140      47139
  intensity 9 16103
  edge_of_flight_line 0 0
  scan_direction_flag 0 0
  number_of_returns_of_given_pulse 1 7
  return_number                    1 7
  classification    240   240
  scan_angle_rank   -11     3
  user_data           0   134
  point_source_ID     5     5
  gps_time 11570.850892 11572.206750
WARNING: there are 13 points with return number 6
WARNING: there are 1 points with return number 7
overview over number of returns of given pulse: 23810 14656 13130 4494 915 72 7
histogram of classification of points:
           57084  Reserved for ASPRS Definition (16)
 +-> flagged as synthetic: 57084
 +-> flagged as keypoints: 57084
 +-> flagged as withheld:  57084

C:\Users\pli\lastools\lastools\bin>las2las -i C:\Users\pli\lastools\lastools\dat
a\house.laz -o C:\Users\pli\house2.laz -set_classification 64
 
C:\Users\pli\lastools\lastools\bin>lasinfo -i C:\Users\pli\house2.laz
reporting all LAS header entries:
 ...
histogram of classification of points:
           57084  Created, never classified (0)
 +-> flagged as keypoints: 57084

C:\Users\pli\lastools\lastools\bin>las2las -i C:\Users\pli\lastools\lastools\dat
a\house.laz -o C:\Users\pli\house2.laz -set_classification 31
 
C:\Users\pli\lastools\lastools\bin>lasinfo -i C:\Users\pli\house2.laz
reporting all LAS header entries:
...
histogram of classification of points:
           57084  Reserved for ASPRS Definition (31)

-Paula

Kirk Waters - NOAA Federal

unread,
Jan 30, 2015, 8:42:29 AM1/30/15
to LAStools - efficient command line tools for LIDAR processing
Paula,
The main issue is the LAS version. LAS versions 1.0 to 1.3 only allow 32 classes. LAS version 1.4 expands that to 256, but only if you use the newer point formats (6 and higher). Your file is version 1.2 and point type 1. You'd need to convert it to version 1.4 and point type 6. You can do that change with
 
las2las -set_version 1.4 -set_point_type 6 -i ..\data\house.laz -o house2.las

(note that the output is las, not laz)

Regards,
Kirk
--
Kirk Waters, PhD                     | NOAA Office for Coastal Management
Applied Sciences Program      | 2234 South Hobson Ave
843-740-1227                          | Charleston, SC 29405    

Antonio Ruiz

unread,
Jan 30, 2015, 8:43:23 AM1/30/15
to last...@googlegroups.com
The 3 highest bits of the class byte are considered as flags and when you set the class to 240 you set the 3 flags to 1. 240 is 11110000 in binary. These flags mean synthetic, keypoint and withheld. The remaining bits (10000) mean 16 in decimal, so the points belong to class 16 and are synthetic, keypoints and withheld.

You can use the classes between 16 and 63 but you have to explain what they mean because it is not defined in the standard. 

Regards

--

Martin Isenburg

unread,
Feb 1, 2015, 11:08:03 PM2/1/15
to last...@googlegroups.com
Hello Paula,

as pointed out by Kirk, LAS 1.1 - 1.3 (and no-one does LAS 1.0 anymore) only allows the lower 5 bits to be used for the classification (0 - 31) with the upper three bits being reserved for three flags (withheld, keypoint, and synthetic) that - as far as I can tell - get unfortunately almost no use in practise.

If you want more that 32 different classifications (aka classification codes 32 to 255) you need to switch to the new point types provided by LAS 1.4. Here how to do this as the example of 'fusa.laz' that is originally a LAS 1.2 file with point type 1:

upgrade the file to LAS 1.4 and point type 6
>> las2las -set_version 1.4 -set_point_type 6 -i ..\data\fusa.laz -o fusa14.las 

see the changes
>> lasinfo -i fusa14.las

change different "extended attributes" with latest LAStools version (150131) 
>> las2las -i fusa14.las ^ 
                 -change_extended_classification_from_to 5 33 ^ 
                 -change_extended_classification_from_to 6 46 ^ 
                 -set_extended_overlap_flag 1 ^ 
                 -set_extended_scanner_channel 2 ^ 
                 -o fusa14mod.las 

see the changes
>> lasinfo -i fusa14mod.las

Cheers,

Martin @rapidlasso

--
http://rapidlasso.com - fast tools for more "classy" LiDARs

Paula Litkey

unread,
Feb 5, 2015, 2:19:23 AM2/5/15
to last...@googlegroups.com


Hei,

Thanks for the replies. In my case the problem is that the classification is already there. The classification is using the 8 bits (although it should use only 5). So the data is there and I know it but cannot get it out with LAStools reader. Now that you pointed out what happened, I can probably just combine withheld, keypoint, synthetic and the classification and reproduce the class in Matlab.

I've been thinking about this and I feel it is not ok that you can actually spoil the data with no warning when writing classification. My inner stupid user is not at all happy with manual format checking. So I'm going to add an input check to the mat2las writer we use, it will change the point type (if needed) when class numbers are large. Actually it would be nice to have some warning in las2las also.

Problem solved anyway, thanks!

-Paula
Reply all
Reply to author
Forward
0 new messages