Monday, May 7, 2018

Using PDAL to perform simple translation transformations on LAS files

Sometimes for whatever reason you may want to apply a simple linear translation (dx, dy, dz) transformation shift on a LiDAR las file. PDAL has a transformation filter that you can use to perform the shifting, but you have to pass in the translation amounts as part of a 4x4 homogeneous transformation matrix.

A 4x4 transformation matrix that performs translations has the following form:
[1 0 0 dx]
[0 1 0 dy]
[0 0 1 dz]
[0 0 0 1]

So to use PDAL to perform a simple translation, just replace the dx, dy, dz with the translation amounts and pass the matrix to the PDAL transformation filter.

The following example command performs a vertical shift of +5.0 to the input las file.
C:> pdal translate -i input.las -o output.laz -f transformation   --filters.transformation.matrix="1 0 0 0 0 1 0 0 0 0 1 5.0 0 0 0 1"  --writers.las.compression="true" -v 4


The following screen shot shows a profile of the input and output las files with the output las file visibly shifted 5.0 above the input las file.


No comments: