Gridding data using user attribute

59 views
Skip to first unread message

Jo Bind

unread,
May 27, 2024, 3:21:22 AMMay 27
to LAStools - efficient tools for LiDAR processing
This might be a very obvious one, but it has me stumped.
Despite having used LAStools for well over a decade, I don't work much with user attributes. But for a recent project, I calculated the height above ground, classified the point cloud into vegetation and buildings and then wanted to grid class 5 (high vegetation) using the height-above-ground values.

My workflow looked something like this:
lasheight -i *.laz -odir Classified -epsg 2193 -olaz -odix _hgt -store_as_extra_bytes
lasclassify -i Classified/*_hgt.laz  -ground_offset 0.3 -odir Classified -olaz -odix _0_3 -height_in_attribute 0
lasgrid -i Classified/*_0_3.laz  -keep_class 5 -attribute 0 -step 1 -average -otif

This worked just as expected with data from one supplier, but another dataset I tried to process was created by Terrascan, which includes a few other user attributes (in my case: Distance, Group, Normal) before (?) the height-above-ground attribute.

Below is the lasinfo result:

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.4
  system identifier:          'LAStools (c) by rapidlasso GmbH'
  generating software:        'lasclassify (230330) commercial'
  file creation day/year:     286/2023
  header size:                375
  offset to point data:       2167
  number var. length records: 4
  point data format:          7
  point data record length:   59
  number of point records:    0
  number of points by return: 0 0 0 0 0
  scale factor x y z:         0.001 0.001 0.001
  offset x y z:               1000000 5000000 0
  min x y z:                  1982560.000 5675280.000 9.977
  max x y z:                  1982891.369 5675999.999 101.372
  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: 6266815
  extended number of points by return: 6137996 114666 13359 771 23 0 0 0 0 0 0 0 0 0 0
variable length header record 1 of 4:
  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 2193 - ProjectedCSTypeGeoKey: NZGD2000 / New Zealand Transverse Mercator 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 4:
  reserved             0
  user ID              'LASF_Spec'
  record ID            4
  length after header  768
  description          'by LAStools of rapidlasso GmbH'
    Extra Byte Descriptions
      data type: 6 (long), name "Distance", description: "Distance", min: 2147483649, max: 2147483647, scale: 1, offset: 0 (not set)
      data type: 5 (unsigned long), name "Group", description: "Group", min: 0, max: 4294967295, scale: 1, offset: 0 (not set)
      data type: 5 (unsigned long), name "Normal", description: "Normal vector 2+15+15 bits", min: 0, max: 0, scale: 1, offset: 0 (not set)
      data type: 4 (short), name "height above ground", description: "vertical point to TIN distance", scale: 0.01, offset: 250
variable length header record 3 of 4:
  reserved             0
  user ID              'LASF_Spec'
  record ID            4
  length after header  192
  description          ''
    Extra Byte Descriptions
      data type: 1 (unsigned char), name "confidence", description: "confidence values", scale: 1 (not set), offset: 0 (not set)
variable length header record 4 of 4:
  reserved             0
  user ID              'LASF_Spec'
  record ID            4
  length after header  576
  description          'TerraScan Extra Bytes'
    Extra Byte Descriptions
      data type: 6 (long), name "Distance", description: "Distance", min: 2147483649, max: 2147483647, scale: 1, offset: 0 (not set)
      data type: 5 (unsigned long), name "Group", description: "Group", min: 0, max: 4294967295, scale: 1, offset: 0 (not set)
      data type: 5 (unsigned long), name "Normal", description: "Normal vector 2+15+15 bits", min: 0, max: 0, scale: 1, offset: 0 (not set)
LASzip compression (version 3.4r3 c3 50000): POINT14 3 RGB14 3 BYTE14 3
reporting minimum and maximum for all LAS point record entries ...
  X           982560000  982891369
  Y           675280000  675999999
  Z                9977     101372
  intensity           6       1625
  return_number       1          5
  number_of_returns   1          5
  edge_of_flight_line 0          1
  scan_direction_flag 0          0
  classification      1         31
  scan_angle_rank   -41         38
  user_data           0          0
  point_source_ID  3501       3601
  gps_time 351317.008705 351518.726303
  Color R 2560 65280
        G 4352 65280
        B 0 65024
  extended_return_number          1      5
  extended_number_of_returns      1      5
  extended_classification         1     31
  extended_scan_angle         -6833   6333
  extended_scanner_channel        0      0
  attribute0          6       1625  ('Distance')
  attribute1          0 4.29497e+009  ('Group')
  attribute2          0          0  ('Normal')
number of first returns:        6137996
number of intermediate returns: 14143
number of last returns:         6138281
number of single returns:       6023605
overview over extended number of returns of given pulse: 6023605 202375 37730 2990 115 0 0 0 0 0 0 0 0 0 0
histogram of classification of points:
           38503  unclassified (1)
           11019  ground (2)
          333127  high vegetation (5)
         5884145  building (6)
              20  noise (7)
               1  Reserved for ASPRS Definition (31)

With these files, the result of lasgrid produced unexpected results. So, I started playing with the -attribute 0  flag in lasgrid and couldn't get anywhere (I tried every position from 0 to 9 without success). How do I grid the height-above-ground values for this dataset?

A (cumbersome and not batch-able) way is to import them into CloudCompare and then only export the desired attribute, but that's not the most efficient way to do it. But I couldn't figure out how to address the right attribute for gridding. Any ideas that would help?

Cheers,
Jo

Jochen Rapidlasso

unread,
May 27, 2024, 11:59:53 AMMay 27
to LAStools - efficient tools for LiDAR processing
Hi Jo,
within your extra_bytes_vlr the height attribute seems to be the 4th one - index starting with 0 - so please try
-attribute 3
as argument. Optional check out the new alternate_z mechanism which should simplify the process.

Cheers,

Jochen @rapidlasso

Jochen Bind

unread,
May 28, 2024, 9:25:36 AMMay 28
to last...@googlegroups.com

Hi Jochen,

That was exactly what my thinking was. But somehow, that didn’t work.

 

Below is the output from

las2txt -parse xyz0123 -i BF44_1000_1935_hgt_0_3.laz -stdout | more

WARNING: attribute '3' does not exist. skipping ...

2060320.023 5752320.299 157.859 1014 327157 0 1014 1014

2060320.042 5752320.005 158.009 1035 523786 0 1035 1035

2060320.037 5752320.014 158.016 1011 589298 0 1011 1011

2060320.023 5752320.090 158.002 1051 523802 0 1051 1051

 

When I prepare a ‘cleaned’ file with CloudCompare (cleaned in that I only export the height-above-ground attribute, deselecting the other attributes in the saving procedure) and run this command, I get the expected results:

las2txt -parse xyz0 -i BF44_1000_1935_hgt_0_3_Jo.laz -stdout | more

2060320.023 5752320.299 157.859 -0.00

2060320.042 5752320.005 158.009 0.14

2060320.037 5752320.014 158.016 0.14

2060320.023 5752320.090 158.002 0.13

2060320.123 5752322.626 157.683 -0.00

2060320.042 5752322.766 157.704 -0.00

2060320.067 5752320.888 157.936 0.15

2060320.093 5752321.233 157.737 -0.00

 

The Warning in the first instance suggests to me that the height-above-ground is not saved as the 4th attribute in this file, but where is it? I used the same file (BF44_1000_1935_hgt_0_3.laz) to open in CloudCompare and export it as BF44_1000_1935_hgt_0_3_Jo.laz. It really confuses me and I have no idea what’s happening.

 

Cheers,

Jo

--
Download LAStools at
https://rapidlasso.de
Manage your settings at
https://groups.google.com/g/lastools/membership
---
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/ea095db4-4184-4cc0-84fd-f97a1eba63f0n%40googlegroups.com.

Jochen Bind
Hydrodynamics and GIS Technician

+64-3-343-8021
+64-21-087-54696
National Institute of Water & Atmospheric Research Ltd (NIWA)
10 Kyle Street Riccarton Christchurch New Zealand
Connect with NIWA: niwa.co.nz Facebook LinkedIn Twitter Instagram YouTube
To ensure compliance with legal requirements and to maintain cyber security standards, NIWA's IT systems are subject to ongoing monitoring, activity logging and auditing. This monitoring and auditing service may be provided by third parties. Such third parties can access information transmitted to, processed by and stored on NIWA's IT systems.
Note: This email is intended solely for the use of the addressee and may contain information that is confidential or subject to legal professional privilege. If you receive this email in error please immediately notify the sender and delete the email.

Jochen Rapidlasso

unread,
May 28, 2024, 9:27:31 AMMay 28
to LAStools - efficient tools for LiDAR processing
Hi Jo,
do you have a small data sample for us? We would like to analyze this.

Thanks,

Jochen @rapidlasso

Reply all
Reply to author
Forward
0 new messages