Monday, August 3, 2015

Tools for Visualizing Lidar Data I


LidarViewer


A friend of mine recently sent me a link to an article on opensource.com titled   Manipulating data in 3D with LidarViewer.  His timing couldn't have been better, since LidarViewer is a free software tool for visualizing Lidar data, and is thus just the kind of thing I need for my Summer project.  Even better, the downloads page starts with an Ubuntu PPA, so installation should not be a nightmare.

I'll do my installation on a VirtualBox VM running Lubuntu 14.04.  I like to use VMs whenever I am trying new software that is not part of the standard Ubuntu software repositories, since this keeps my host machine stable, while letting me experiment without fear.

Here is what I did:
$ sudo apt-add-repository ppa:keckcaves/ppa
$ sudo aptitude update
The installation page doesn't list the packages included in the PPA, but the Launchpad page for the repo does.  There is a package named lidarviewer, so I'll install that:
$ sudo aptitude install lidarviewer
Running lidarviewer at the command prompt after installation completed gave me a "command not found", so I checked to see what the package had installed:
$ dpkg -L lidarviewer
/.
/etc
/etc/LidarViewer
/etc/LidarViewer/LidarViewer.cfg
/usr
/usr/bin
/usr/bin/LidarIlluminator
/usr/bin/PaulBunyan
/usr/bin/LidarPreprocessor
/usr/bin/LidarSubtractor
/usr/bin/LidarGridder
/usr/bin/CalcLasRange
/usr/bin/LidarExporter
/usr/bin/PointSetSimilarity
/usr/bin/PrintPrimitiveFile
/usr/bin/LidarViewer
/usr/bin/LidarColorMapper
/usr/bin/LidarSpotRemover
/usr/share
/usr/share/doc
/usr/share/doc/lidarviewer
/usr/share/doc/lidarviewer/changelog.Debian.gz
/usr/share/doc/lidarviewer/copyright
/usr/share/doc/lidarviewer/HISTORY.gz
/usr/share/doc/lidarviewer/README.gz

$
I tried:
$ LidarViewer
Caught exception LidarViewer::LidarViewer: No octree file name provided
A quick search on the exception led me to the Lidar Viewer Manual.  Since I already installed the application from the Ubuntu PPA (Ubuntu rocks!), I can skip most of the installation instruction section. In the MacOS instructions, however, I found sample data for testing the application.  Downloading and unzipping the sample data, I changed into the LidarViewerExamples directory and ran the following command and got the following error:
$ LidarViewer PtArena.lidar
Cache sizes: 4672 memory nodes, 1170 GPU nodes
libGL error: pci id for fd 12: 80ee:beef, driver (null)
OpenGL Warning: Failed to connect to host. Make sure 3D acceleration is enabled for this VM.
libGL error: core dri or dri2 extension not found
libGL error: failed to load driver: vboxvideo
I'm using a VirtualBox VM, and this message is telling me to enable 3D acceleration.  After enabling 3D acceleration on the VM, the application reported a long list of OpenGL errors.  I found this bug ticket showing I'm not the only one with the issue.

I added the same PPA to a laptop running Ubuntu 14.04 (thus loosing the safety of the virtual machine) and installed both the lidarviewer and  vrui-examples packages, after which I could run the examples on the laptop without error.

lidar2dems


Next I'm going to install another set of tools for visualizing and processing Lidar data, lidar2dems.  Installation instructions are found here, and contain a number of utilities such as LAStools, which I'll need to uncompress the LAZ files that are on the Virginia Lidar website.

Installation of the lidar2dems software is made easy by an installation script, easy-install.sh.  After downloading the script, run:
$ chmod +x easy-install.sh
$ sudo ./easy-install.sh
The script took almost two hours to complete on my VirtualBox VM, but it completed without error.

It did not, however, install many of the LAStools utilities, especially laszip, as I had hoped.

laszip


To get laszip, I went to http://www.laszip.org and downloaded laszip.zip.  Then:
$ unzip laszip.zip
 which created a LAStools directory with several subdirectories, including a bin subdirectory that contained windows .exe binaries and _README.txt text files for many LASzip utilities, including laszip.exe.  Next I:
$ cd LAStools
$ make
This created the following Linux binaries in the bin directory:
las2las  lasdiff   lasinfo   lasprecision  txt2las
las2txt  lasindex  lasmerge  laszip
To test if laszip works, I grabbed a LAZ file for downtown Leesburg:
$ wget https://703348910b61e15b5d68b83128b735c09c3849cb.googledrive.com/host/0B_5XlZJJ2R5tUjZFb1FQTnU1alk/18STJ7733.laz
This got me the file 18STJ7733.laz. Then I ran:
$ ls -l
total 16624
-rw-rw-r-- 1 user user 17019618 Aug 17  2012 18STJ7733.laz
$ laszip 18STJ7733.laz
$ ls -l
total 149256
-rw-rw-r-- 1 jelkner jelkner 135810762 Aug  3 12:05 18STJ7733.las
-rw-rw-r-- 1 jelkner jelkner  17019618 Aug 17  2012 18STJ7733.laz
So it appears to have uncompressed the LAZ file into a much larger (almost 8x larger) LAS file.

Given that it is free software with an LGPL license, I don't understand why someone in the Open Source GIS community hasn't made this installation much simpler on Ubuntu yet.  For now, I've made a modest contribution toward that goal by creating a page with the Ubuntu binaries on my Open Book Project site:
http://openbookproject.net/resources/laszip.php

1 comment:

  1. I need for my Summer project. Even better, the downloads page starts with an Ubuntu PPA, so installation should not be a nightmare. easy invoicing

    ReplyDelete