PTX/PTS to LAZ (and back)

501 views
Skip to first unread message

Martin Isenburg

unread,
Jun 14, 2014, 9:21:36 AM6/14/14
to LAStools - efficient command line tools for LIDAR processing
Hello,

here a follow-up to a recent post about the capability to convert from the ASCII formats PTS and PTX to LAZ and back without losing the additional information. The following example uses txt2las with option '-iptx' and las2las with option '-optx' to preserve the col and row information as well as the transformation vectors and matrices stored at the beginning of each PTX file:

more sample.ptx
2
3
4.151261 1.736411 -8.110131
-0.434947 -0.017233 -0.900291
-0.240839 0.965618 0.097871
0.867650 0.259394 -0.424143
-0.434947 -0.017233 -0.900291 0
-0.240839 0.965618 0.097871 0
0.867650 0.259394 -0.424143 0
4.151261 1.736411 -8.110131 1
4.146983 12.074142 1.134998 0.488502 76 74 91
4.147541 12.075727 1.136227 0.486915 76 74 91
4.147919 12.076833 1.137371 0.486976 76 74 91
4.148849 12.079544 1.138655 0.485328 76 74 91
4.146931 12.073991 1.139137 0.486076 76 74 91
4.148440 12.078399 1.140532 0.488441 79 76 93

txt2las -i sample.ptx -iptx ^
          -set_scale 0.000001 0.000001 0.000001 ^
          -iparse xyziRGB -olaz

las2las -i sample.laz ^
           -optx -o sample_recovered.ptx

more sample_recovered.ptx
2
3
4.15126 1.73641 -8.11013
-0.434947 -0.017233 -0.900291
-0.240839 0.965618 0.097871
0.86765 0.259394 -0.424143
-0.434947 -0.017233 -0.900291 0
-0.240839 0.965618 0.097871 0
0.86765 0.259394 -0.424143 0
4.15126 1.73641 -8.11013 1
4.146983 12.074142 1.134998 0.488 76 74 91
4.147541 12.075727 1.136227 0.487 76 74 91
4.147919 12.076833 1.137371 0.487 76 74 91
4.148849 12.079544 1.138655 0.485 76 74 91
4.146931 12.073991 1.139137 0.486 76 74 91
4.148440 12.078399 1.140532 0.488 79 76 93

The first 10 lines of the PTX file contain special information that is parsed when txt2las is run with the '-iptx' switch and then stored as a VLR into the LAZ file. These first 10 lines can be recreated when this VLR is present by giving las2las with the '-optx' switch. Below you see how the PTX file contents are stored while it is a LAZ file.

The same VLR is produced done when using pointzip.exe and pointunzip.exe from http://pointzip.org to do the PTX to and from LAZ conversion ...

Regards,

Martin @rapidlasso

PS: Generally I would suggest to use more appropriate scaling factors instead of preserving the non-existant micrometer resolution with '-set_scale 0.000001 0.000001 0.000001'

lasinfo -i sample.laz
lasinfo for sample.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 rapidlasso GmbH'
  generating software:        'txt2las (version 140609)'
  file creation day/year:     165/2014
  header size:                227
  offset to point data:       553
  number var. length records: 1
  point data format:          2
  point data record length:   26
  number of point records:    6
  number of points by return: 6 0 0 0 0
  scale factor x y z:         0.000001 0.000001 0.000001
  offset x y z:               0 10 0
  min x y z:                  4.146931 12.073991 1.134998
  max x y z:                  4.148849 12.079544 1.140532
variable length header record 1 of 1:
  reserved             43707
  user ID              'LAStools'
  record ID            2001
  length after header  272
  description          'by LAStools of rapidlasso GmbH'
LASzip compression (version 2.2r0 c2 50000): POINT10 2 RGB12 2
reporting minimum and maximum for all LAS point record entries ...
  X             4146931    4148849
  Y             2073991    2079544
  Z             1134998    1140532
  intensity        1987       2000
  return_number       1          1
  number_of_returns   1          1
  edge_of_flight_line 0          0
  scan_direction_flag 0          0
  classification      0          0
  scan_angle_rank     0          0
  user_data           0          0
  point_source_ID     0          0
  Color R 76 79
        G 74 76
        B 91 93
overview over number of returns of given pulse: 6 0 0 0 0 0 0
histogram of classification of points:
               6  never classified (0)

sample.ptx

Quan Tran

unread,
Jul 23, 2020, 9:14:58 PM7/23/20
to LAStools - efficient tools for LiDAR processing
Maybe a few years a bit late. But laszip64.exe -v -i sample.ptx -iptx -iparse xyziRGB -o sample.laz works a charm also! 
Reply all
Reply to author
Forward
0 new messages