lascopy for extra byte attributes

107 views
Skip to first unread message

Jed Abanat

unread,
Feb 6, 2020, 6:10:51 PM2/6/20
to LAStools - efficient tools for LiDAR processing
Hello,

I have a LAS 1.4 PDRF 9 file with some extra byte attributes and I am trying to replace the values in the attributes with new ones, currently stored in a separate text file (the records are in the same order). I understand that I could use lascopy if I wanted to copy the classifications/intensity/elevations to the existing LAS file, but I can't find a way to copy the extra byte attributes over. Does anyone know of a way I could do this?

Thanks,
Jed

David Friedrich

unread,
Feb 7, 2020, 7:09:28 AM2/7/20
to last...@googlegroups.com
Hi Jed,

with las2las you can manipulate the extra byte values:

-set_attribute_scale 0 0.1     : sets the scale of the *first* attribute in the extra bytes to 0.1
-set_attribute_offset 1 10.0   : sets the offset of the *second* attribute in the extra bytes to 10.0 

Cheers,
David

------ Originalnachricht ------
Von: "Jed Abanat" <jed...@gmail.com>
An: "LAStools - efficient tools for LiDAR processing" <last...@googlegroups.com>
Gesendet: 06.02.2020 11:57:14
Betreff: [LAStools] lascopy for extra byte attributes

--
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/d3e66bb2-f7b1-4fe6-a449-ec42f01c2afa%40googlegroups.com.

Jed Abanat

unread,
Feb 7, 2020, 6:18:30 PM2/7/20
to LAStools - efficient tools for LiDAR processing
Hi David,

Thanks for that. I did find that option, however need something more than just the static scaling value to recompute that field, I'm essentially re-writing the attribute values.

Thanks,
Jed
To unsubscribe from this group and stop receiving emails from it, send an email to last...@googlegroups.com.

Martin Isenburg

unread,
Feb 9, 2020, 8:07:52 PM2/9/20
to LAStools - efficient command line tools for LIDAR processing
Hello,

I have added the ability to add a new attribute (all zeroes) and then load attribute values (from a text file) to las2las and you can download this new version of las2las (200210) here:


las2las -version
LAStools (by mar...@rapidlasso.com) version 200210

The loading of a new attribute from file requires two steps. Here a small example:

las2txt -i ..\data\fusa.laz -parse i -o new_attribute.txt  
las2las -i ..\data\fusa.laz -add_attribute 3 "extra intensity" "test of loading attributes" -o fusa_zeroed_attribute.laz
las2las -i fusa_zeroed_attribute.laz -load_attribute_from_text 0 new_attribute.txt -o fusa_loaded_attribute.laz 

Below the example with more details:

:: creating some (pseudo) new attribute in a text file, one line per point:

las2txt -i ..\data\fusa.laz -parse i -o new_attribute.txt

more  new_attribute.txt 
10
15
12
12
18
19
[...]

:: adding a new attribute to "fusa.laz" that is initialized to all zeroes

las2las -i ..\data\fusa.laz -add_attribute 3 "extra intensity" "test of loading attributes" -o fusa_zeroed_attribute.laz

:: check result with lasinfo

lasinfo -i fusa_zeroed_attribute.laz
lasinfo (200209) report for 'fusa_zeroed_attribute.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 200210)'
  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: 3 (unsigned short), name "extra intensity", description: "test of loading attributes", scale: 1 (not set), offset: 0 (not set)
LASzip compression (version 3.4r3 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          6
  scan_angle_rank    79        103
  user_data           0        197
  point_source_ID     1          1
  gps_time 5880.963028 5886.739738
  attribute0          0          0  ('extra intensity')
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)

:: load new attributes from text file and store them to attribute 0

las2las -i fusa_zeroed_attribute.laz -load_attribute_from_text 0 new_attribute.txt -o fusa_loaded_attribute.laz

:: check the result

lasinfo -i fusa_loaded_attribute.laz
lasinfo (200209) report for 'fusa_loaded_attribute.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 200210)'
  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: 3 (unsigned short), name "extra intensity", description: "test of loading attributes", scale: 1 (not set), offset: 0 (not set)
LASzip compression (version 3.4r3 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          6
  scan_angle_rank    79        103
  user_data           0        197
  point_source_ID     1          1
  gps_time 5880.963028 5886.739738
  attribute0         10      62293  ('extra intensity')
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)

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/3ea94eae-f608-4359-83b5-acc16a6aa515%40googlegroups.com.

Jed Abanat

unread,
Feb 10, 2020, 9:54:04 AM2/10/20
to LAStools - efficient tools for LiDAR processing
Hi Martin,

Fantastic, thank you so much for this.

Appreciate it!

Jed
Reply all
Reply to author
Forward
0 new messages