Monday, January 15, 2018

displaz - A small but fast LiDAR las file viewer

I'm happy with this LiDAR las file viewer displaz I stumbled upon while doing some searching on Google. It's free, open-source, no-frills, fast, and relatively easy to use - just perfect to drag and drop some las files for a quick look. It can be downloaded from this web site http://c42f.github.io/displaz/.

The following are some sample screenshots of the viewer.
  1. Upon start up, the viewer shows a blank view with a shader parameters and Log or Datasets panes on the right.



    Note: The points are colored according to intensity values. This can be changed by choosing an alternative coloring method in the Shader parameters pane
    .
  2. Las files and be opened by simply dragging it(them) and dropping onto the application window from the operating system's file managers.


    Note: once opened, the file(s) are listed in the Datasets pane. To view the point cloud from a different orientation, drag and move the mouse left button. To zoom, roll the mouse wheel.
  3. This is a little confusing at first, but to pan or move the view, you have to press the middle button of the mouse to center the view around the chosen point. At the same time, it will show the attributes of the chosen point in the Log pane, as shown below.


  4. Finally, to unload a las file, select one or more files in the Datasets pane and press the DELETE button on the keyboard.



Monday, January 8, 2018

Getting FugroViewer to run in Ubuntu 16.04

I wanted to try running the free but not open source Lidar viewer from Fugro on Ubuntu. FugroViewer can be downloaded from https://www.fugro.com/about-fugro/our-expertise/technology/fugroviewer.

Since FugroViewer is a Windows only application, I had to use Wine to install and run it. I was successful in getting it to run and the following steps illustrate how to set up, install and run FugroViewer on Ubuntu.

Install Wine

  1. In Ubuntu, open up a terminal.
  2. At the command prompt, type in the following command to download a key. Press RETURN.

    $ wget https://dl.winehq.org/wine-builds/Release.key

    The file Release.key is downloaded.

  3. Next, add the key to Ubuntu. Type in the admin password when prompted.

    $ sudo apt-key add Release.key


  4. Now add in the Wine repository to Ubuntu by entering the following command:

    $ sudo apt-add-repository 'https://dl.winehq.org/wine-builds/ubuntu/'


  5. At the command prompt, type in the command:

    $ sudo apt-get update

  6. Finally, install Wine with the following command.

    $ sudo apt-get install wine


Install FugroViewer

Once Wine is installed, it can be used to run the FugroViewer installer (which must be downloaded from the Fugro web site https://www.fugro.com/about-fugro/our-expertise/technology/fugroviewer previously).

  1.  Using a File Manager in Ubuntu, browse to the location of the downloaded FugroViewer installer. Double click on the file or press mouse right click and choose Open with Wine Windows Program.


    The Fugro Viewer Setup wizard appears.
  2. Complete the installation by following the Fugro Viewer Setup wizard.


Running FugroViewer
  1. On the desktop, click the Dash button on the top right. Then type in fugro.

    The FugroViewer application icon is shown.

  2. Click on the FugroViewer icon.

    The FugroViewer application starts up.
  3. Now load in one or more LAS files.

    The LAS file is displayed.

Monday, December 11, 2017

Generating LiDAR flight line boundaries with PDAL's tindex

A common task after an airborne LiDAR data collection is to determine the boundaries of the LiDAR LAS file strips, to visualize where they cover approximately. The screenshot below shows an example of how these LiDAR strips look like, colored by elevation. 
Example of LiDAR data strips
The boundaries can be generated in various formats using PDAL's tindex command. Using this command is simple, as shown in the example steps below:

  1. Open up the OSGeo4W Command Prompt. Change the directory to the folder containing the *.laz files.

    A folder containing LiDAR *.las file strips

    1. At the prompt, type in the command:

      C:\> pdal tindex boundary.sqlite *.laz -f SQLite --lyr_name "bnd"

      where boundary.sqlite is the output file
      *.laz specifies the input files using a wildcard
      -f SQLite is the output format
      --lyr_name "bnd" specifies the layer name to append to the output name
    2. Press RETURN.

      The boundaries are generated.

    3. Optional. After the process is completed, drag and drop the output file e.g. boundary.sqlite onto QGIS.

      The LiDAR strips boundary_bnd_polygon are displayed.


      The output boundaries have the following attributes as shown below.



    Monday, August 7, 2017

    Android Studio Emulator: How I resolved a Google Maps SupportMapFragment GLThread exception

    While attempting to open up a Google Maps SupportMapFragment in the Android Studio Emulator, the Activity crashed with the following error messages:

    [ 08-07 00:50:44.423  3266: 3523 W/         ]
                                                                         Unrecognized GLES max version string in extensions: ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_dma_v1 
    08-07 00:50:44.429 3266-3523/com.dom925.volcamr.nz E/EGL_emulation: rcCreateContext returned 0
    08-07 00:50:44.429 3266-3523/com.dom925.volcamr.nz E/EGL_emulation: tid 3523: eglCreateContext(1434): error 0x3003 (EGL_BAD_ALLOC)
                                                                        
                                                                        --------- beginning of crash
    08-07 00:50:44.429 3266-3523/com.dom925.volcamr.nz E/AndroidRuntime: FATAL EXCEPTION: GLThread 276
                                                                         Process: com.dom925.volcamr.nz, PID: 3266
                                                                         java.lang.RuntimeException: createContext failed: 12291
                                                                             at com.google.maps.api.android.lib6.gmm6.vector.az.a(:com.google.android.gms.DynamiteModulesB:29)
                                                                             at com.google.maps.api.android.lib6.gmm6.vector.ba.f(:com.google.android.gms.DynamiteModulesB:158)
                                                                             at com.google.maps.api.android.lib6.gmm6.vector.ba.run(:com.google.android.gms.DynamiteModulesB:11)
    

    The same Android app has no issue running on a real handset.

    After some fiddling around with the emulator settings, the problem was resolved by changing the emulator's graphics emulated performance from automatic to either Hardware GLES 2.0 or Software GLES 2.0 as shown below.

    Monday, July 31, 2017

    PDAL: Colorize a LAS file with multiple GeoTiff images

    A LiDAR LAS file may not necessarily share the same bounds as a single raster image file. More often the case, to cover the LAS file more than one raster image file is needed. One way to resolve this is to merge all the raster images into a single mosaic file. Another way may be to keep the raster images as they are and load them in one by one (just-in-time fashion) to colorize the LAS file. This workflow is a little more complicated but it can be done using PDAL's pipeline processing mechanism.

    In this post, PDAL will be used to colorize a LAS file using multiple tiles of GeoTIFF image files - four to be exact. You just need to create a pipeline that loads in the LAS file, apply the RGB values from each image file individually and write the colored points into an output LAS file. The following sections illustrate this workflow.

    Here's how the source LAS and GeoTIFF files look like.
    The source LiDAR LAS file displayed by elevation
    The source GeoTIFF raster image files
    Create a PDAL pipeline JSON file
    1. Using a text editor, type in the JSON syntax to colorize a LAS file using PDAL's colorization filter, as shown below.


      where
      uncompahgre.laz is the source LAS file,
      tile0.tif, tile1.tif, tile2.tif and tile3.tif are the source image files,
      and color.laz is the output LAS file name

    2. Save the text into a file e.g. colorLas.json.
    A sample pipeline JSON is show in the listing below.

    {
        "pipeline": [
            "uncompahgre.laz",
            {
                "type": "filters.colorization",
                "raster": "tile0.tif"
            },
            {
                "type": "filters.colorization",
                "raster": "tile1.tif"
            },
            {
                "type": "filters.colorization",
                "raster": "tile2.tif"
            },
            {
                "type": "filters.colorization",
                "raster": "tile3.tif"
            },
            {
                "type": "writers.las",
                "compression": "true",
                "minor_version": "2",
                "dataformat_id": "3",
                "filename":"color.laz"
            }
        ]
    }
    

    Run the colorization process

    1. Open up a OSGeo4W Command Prompt.
    2. At the prompt, type in the pdal pipeline command:

      c:\> pdal pipeline colorLas.json
      where colorLas.json is the pipeline JSON file created in the previous section.
    3. Run the command.

      Processing messages appear.


      The output colorized LAS file color.laz is generated.
    4. Optional. Display the resultant colored LAS file in a LAS Viewer.



    Tuesday, July 25, 2017

    Using Orfeo ToolBox to combine grayscale TIFF images into RGB and CIR composites

    For working with geo-referenced TIFF images, Orfeo ToolBox (OTB) provides a useful convenience function otbcli_concatenateImages to combine separate grayscale images into a composite file. Examples of separate bands of grayscale images are shown below.

    For instance, the separate grayscale bands representing the red, green and blue channels can be combined into a single RGB composite image. To do this using OTB, the following steps can be done.

    1. Open up a OSGeo4W Command Prompt.
    2. At the prompt, type in the otbcli_concatenateImages command with options:

      C:\> otbcli_concatenateImages -il band_red.tif band_green.tif band_blue.tif -out rgb.tif uint16

      where
      band_red.tif, band_green.tif, and band_blue.tif are the input files in the correct order,
      rgb.tif is the output RGB composite file
      uint16 is the output file datatype. By default it is float32 but that is too much. 
    3. Run the command.

      Processing messages appear. The bands are merged into the output file rgb.tif.
    4. Optional. Display the resultant file in a suitable viewer.

    Similarly, to combine the separate grayscale bands into a composite Colored Infra-Red CIR file, the following steps can be done.

    1. Open up a OSGeo4W Command Prompt.
    2. Type in the otbcli_concatenateImages command.

      C:\> otbcli_concatenateImages -il band_nir.tif band_red.tif band_green.tif -out cir.tif uint16
      Where
      band_nir.tif, band_red.tif, and band_green.tif are the ordered input bands
      cir.tif is the output file name
      uint16 is the output file data type
    3. Run the command.

      Processing messages appear. The bands are merged into the output file cir.tif.
    4. Optional. Display the resultant file in a suitable viewer.


    Monday, July 17, 2017

    Use PDAL to generate a DEM from a LiDAR LAS file

    PDAL can be used to generate a GeoTIFF digital elevation model (DEM) from a LiDAR point cloud LAS file via the GDAL writer driver. The resultant elevation GeoTIFF file may not be displayed as what is expected in some software such as Global Mapper because the PDAL generated file can have one or more bands of data including an alpha channel, depending on the PDAL options used; refer to https://www.pdal.io/stages/writers.gdal.html for the types of output bands that can be written to the DEM GeoTIFF file. For normal display, it might be necessary to separate the bands into individual files - in this post, the OTB (Orfeo Tool Box) otbcli_splitImage executable is used.

    The following steps show how to generate a GeoTIFF DEM and split the resultant file into separate bands.

    Generate the DEM

    1. Open up a text editor. Type in the following JSON text. Save the text into a file e.g. pdal_dtm.json



      Note: the JSON pipeline text will do the following:
      (a) Load in a LAS file e.g. autzen.laz
      (b) Filter away non-ground classified point
      (c) Write only the mean Z values to a GeoTIFF file dem.tif with a resolution of 10 meters

    2. Open up the OSGeo4W Command Prompt.

      The Command Prompt appears.
    3. Type in the PDAL command to process the pipeline. Run the command.

      C:\> pdal pipeline pdal_dtm.json

      The GeoTIFF file dem.tif is generated.
    Splitting the bands

    Displaying the resultant dem.tif containing only the mean Z band in QGIS will show something resembling a grayscale terrain with masked areas, as shown in the screenshot below.

    However, displaying the resultant GeoTIFF in Global Mapper will show a black rectangle, as shown below, due to the presence of an alpha channel. This need to be removed for proper interpretation of the elevation data.

    To split the bands, do the following:

    1. In the OSGeo4W Command Window, type in the command:

      C:\> otbcli_splitimage -in dem.tif -out split.tif



      The input file dem.tif is split into separate files with a numbered suffix starting from 0 e.g. split_0.tif.
    2. Now, the file can be displayed properly in Global Mapper.
    Related Posts with Thumbnails