In this tutorial, we will use pip to install Laspy; if you do not have pip installed, install it according to these instructions.
Now, type: pip install laspy in your command line / terminal; once the installation has finished, type import laspy in your Python shell to ensure laspy is installed correctly.
First, lets load our first .las file!
Create a python script called Parse.py, or any other name, and write the following:
This opens a .las file called "file.las," and converts in laspy object. We can specify whether we want to read, write, or append the .las file by typing: laspy.file.File(f_name, mode='r'), where "r" can be replaced with "w" or "a," for writing and appending, respectively.
Now, lets examine the point cloud data within our .las file. Type:
This converts the underlying x, y, z components of our point cloud data into a list of <x¸ y, z> components, represented as a numpy array.
Once we have the point cloud data in a numpy array, it can be processed and converted into any other data format.
For more complicated features, see the official Laspy tutorial.
While .las files are useful, they cannot be read directly by the YURT, so we will have to convert our .las files into .out files.
This process can somewhat complex, depending on how much data is in the .las file.
In particular, if there is more than 1 GB of point cloud data, we will need to create a buffer to decompose this process. For instance, we will load 100 MB of data into memory, save that data into our .out file, and repeat.
The following script provides and example of how to convert a large .las file into a .out file:
The source code for this script can be found here.