Hello Mattias,
the streaming on-the-fly transform '-switch_x_y' only switches the raw
integers fields X and Y of every point record. It should really be
called '-switch_X_Y' and likely I will change this soon. This
'-switch_X_Y' only produces the desired result in your case if the
x_offset and the y_offset as well as the x_scale_factor and the
ynot_scale_factor in the header of the LAS / LAZ file are identical.
If they are not you will need to switch those too. Currently this has
to be done manually by first (!) using lasinfo's '-set_offset x y z'.
I just realize that this is one example where poorly chosen (aka ugly)
scale factors and offsets like these ones here that I just came
across:
[...]
scale factor x y z: 0.000000699800645 0.000000467563925 0.000000105423387
offset x y z: 7860029.2694503004 904315.10862596892 636.79500000000007
[...]
can be really quite annoying.
Here the workflow
(1) check the scale factor and offsets with lasinfo
D:\lastools\bin>lasinfo -i in.laz
[...]
scale factor x y z: 0.01 0.01 0.01
offset x y z: 200000 6100000 0
min x y z: 277750.00 6122250.00 42.21
max x y z: 277999.99 6122499.99 64.35
[...]
reporting minimum and maximum for all LAS point record entries ...
X 7775000 7799999
Y 2225000 2249999
Z 4221 6435
[...]
(2) switch those that need switching
D:\lastools\bin>lasinfo -i in.laz -set_offset 6100000 200000 0 -nh -nc
(3) verify they were changed with lasinfo. the warnings are expected
D:\lastools\bin>lasinfo -i in.laz
[...]
scale factor x y z: 0.01 0.01 0.01
offset x y z: 6100000 200000 0
min x y z: 277750.00 6122250.00 42.21
max x y z: 277999.99 6122499.99 64.35
[...]
reporting minimum and maximum for all LAS point record entries ...
X 7775000 7799999
Y 2225000 2249999
Z 4221 6435
[...]
WARNING: 277573 points outside of header bounding box
[...]
real max x larger than header max x by 5900000.000000
real min y smaller than header min y by 5900000.000000
[...]
(4) do the switch of X and Y
D:\lastools\bin>las2las -i in.laz -switch_x_y -o out.laz
(5) verify the final result
D:\lastools\bin>lasinfo -i out.laz
[...]
scale factor x y z: 0.01 0.01 0.01
offset x y z: 6100000 200000 0
min x y z: 6122250.00 277750.00 42.21
max x y z: 6122499.99 277999.99 64.35
[...]
reporting minimum and maximum for all LAS point record entries ...
X 2225000 2249999
Y 7775000 7799999
Z 4221 6435
[...]
(6) scream "Yeah, I did it!!!". (-;
Cheers,
Martin @rapidlasso
--
http://rapidlasso.com - fast tools to switch your LiDARs