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
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)