PTX/PTS <-> LAZ/LAS (lossless)

Please post all open source software related items here, eg OpenScanTools
Post Reply
User avatar
lastools
V.I.P Member
V.I.P Member
Posts: 144
Joined: Tue Mar 16, 2010 3:06 am
14
Full Name: Martin Isenburg
Company Details: rapidlasso - fast tools to catch reality
Company Position Title: creators of LAStools and LASzip
Country: Germany
Skype Name: isenburg
Linkedin Profile: Yes
Been thanked: 1 time
Contact:

PTX/PTS <-> LAZ/LAS (lossless)

Post by lastools »

Hello from @rapidlasso,

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

Return to “Open Source Software”