Monday, May 21, 2018

Perform a 2D geo-registration of a LiDAR LAS file to a GeoTiff image with Cloud Compare

Recently I received LiDAR LAS point clouds generated without using accurate GPS positioning. As a result, the data is not placed at the correct geographic location in the world. To rectify this, I used Cloud Compare to so-called geo-register the point clouds to the world using GeoTiff images as reference.

The following illustrates how it was done:

Load the GeoTiff image as reference
  1. Start Cloud Compare.


  2. Select File | Open.

    The Open file(s) dialog box appears.

  3. Browse and select the reference GeoTiff raster file, e.g. autzen.tif. Click Open.

    The Result type prompt appears.

  4. Click No to load as a texture map instead of converting to a point cloud.

    The Global shift/scale dialog box appears.

  5. Accept the defaults. Click Yes.

    The GeoTiff image is loaded.
Load the LAS file
  1. Select File | Open.


  2. Browse and choose the LAS file, e.g. autzen.las. Click Open.

    The Open LAS File dialog box appears.
  3. Click Apply.

    The Global shift/scale dialog box appears.

  4. Click Yes to accept the defaults.

    The LAS file is loaded.
 Setup the display
  1. In the vertical tool bar on the left, click the Set Current View Mode icon
    and choose Orthographic projection.

    Note: we do not want the perspective projection display to mislead us as to the location of the features
  2. Optional. Select Edit | Colors | Height Ramp. Click OK in the Gradient color dialog box to display the point cloud with a height color gradient for better visualization.


Perform the rectification
  1.  In the DB Tree pane, select the point cloud to rectify, e.g. autzen.las.
  2. In the top tool bar, click the Translate/Rotate icon .

    The Translate/Rotate widget appears in the top right corner.
  3. In the Rotation field, select Z. Toggle off Tz.

    Note: we only want to move horizontally in the 2D plane.
  4. Look for matching features in the point cloud and the GeoTiff image.



  5. To translate the point cloud, press down the mouse right button and drag the point cloud to the new location. To rotate the point cloud, press down the mouse left button and rotate the point cloud.

    Note 1: To toggle the display of the point cloud, toggle on/off the Visible property in the Properties pane on the left.
    Note 2: To zoom in/out/pane around, pause the Translate/Rotate widget by clicking the widget's Pause icon.
  6. In the Translate/Rotate widget, click the Tick icon to save the changes.

    The point cloud is rectified.


Monday, May 14, 2018

Use PDAL to apply a vertical datum geoid correction to a LAS file

PDAL can be used to apply a vertical datum correction to LAS files, e.g. to convert LiDAR data in ellipsoidal heights to mean sea level using a geoid such as the EGM2008. PDAL uses geoids in gtx format and can be downloaded from http://download.osgeo.org/proj/vdatum/

The following steps show how to perform a vertical datum correction with the reprojection filter of PDAL:
  1. Optional. Download an appropriate geoid file e.g. egm08_25.gtx for EGM2008 from http://download.osgeo.org/proj/vdatum/ and place it in a folder e.g. D:\Temp\PDAL\
  2. Open up the OSGeo4W Shell.
  3. In the Command Prompt, type in the following command:

    D:\> pdal translate -i input.las -o output.laz reprojection --filters.reprojection.in_srs="EPSG:32610+4326" --filters.reprojection.out_srs="+init=EPSG:32610 +geoidgrids=D:/Temp/PDAL/egm08_25.gtx" --writers.las.compression="true" --writers.las.a_srs="EPSG:32610+3855" -v 4

    where
    --filters.reprojection.in_srs specifies the source coordinate reference system EPSG:32610 or UTM 10 North  and the source vertical datum of EPSG:4326 which is the WGS84 Ellipsoid

    --filters.reprojection.out_srs specifies the destination coordinate reference system EPSG:32610 (the same as the input) and the EGM2008 grid file to apply

    --writers.las.a_srs tells PDAL to write the destination coordinate reference system of EPSG:32610 and vertical datum EPSG:3855 (which is the EGM2008 datum) to the output file.


  4. Press RETURN.

    Processing messages appear. The input las file is reprojected to the EGM2008 vertical datum.

  5. Optional. Overlay the input and output LAS files in a viewer and observe the vertical offset in a profile as shown below.

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.