We are happy to press-release some chocolate-sweet new functionality in LAStools. Today, on Valentine’s Day 2014, we propose to wrap lean yet plush layers around your LiDAR with the new *.lay file. After the *.lax and *.laz files the *.lay file had to come, because x and z need the y to really make a point … (-;
The new concept is called “LASlayers“. It allows adding layers of modifications or additional attributes on top of an existing LAS or LAZ file. This means much lower I/O times (or transmission bandwidth) because only those parts of a file need to be written back to disk (across a network) that have actually changed.
Most of the point attributes (e.g. xyz coordinates, intensities, scan angles, GPS times, WavePackets, …) are not modified when processing LiDAR. LASlayers avoids copying the unchanged parts a second (or third or fourth) time to a new LAS or LAZ file by storing only the differences to a corresponding “LAY” file. For example, changing the point classifications or deleting a few points, can usually be expressed with less than one percent compared to the size of a new LAS or LAZ file. Similarly, adding height above ground information results in LAY files that are just 10 to 15 percent of the original file.
On one hand LASlayers can be viewed as a differential coding scheme that achieves incredible compression rates. On the other hand LASlayers can be seen as making LAZ files editable for all practical purposes, overcoming the most fundamental drawback of compressed LiDAR before LASlayers. Furthermore, LASlayers keep track of the processing history and all changes applied to a LAS or LAZ file this way can simply be undone by “peeling off” the layers. A target number of layers can be loaded on-the-fly providing simultaneous access to multiple versions of the same LAS/LAZ file. A LiDAR server, for example, can now store only a single copy of the data and apply various LASlayers on demand (e.g. with ellipsoidal or orthometric elevations, with or without RGB colors).
Finally – by keeping LAY files in different directories – you could also produce different processing results resulting from different parameter settings or pipelines with much smaller file sizes. The original raw information that usually does not change such as XYZ, intensity, return numbers, scan angles, GPS times, or Waveform Packets will only be stored once so that the overhead of keeping the results of more than one LiDAR processing workflow is minimized. Of course you can always produce a new LAS/LAZ file for client delivery or for interchange with other software by applying all changes down to the desired layer.
Instead of storing LASlayers to separate LAY files, future versions of LAStools will allow to append them to the end of a LAS/LAZ file by utilizing the concept of Extended Variable Length Records (EVLRs) that was introduced with the LAS 1.4 specification (in the same way as planned for the spatial indexing LAX files).
Also users of other LiDAR processing software can readily take advantage of LASlayers with the new “laslayers.exe” tool that computes the difference between a raw and a modified LAS or LAZ file and expresses it as a LAY file (assuming the point order has not changed). A typical use case is the exchange of modifications to LiDAR files between a vendor in Australia or Canada and a data processing center in China or India. Instead of up- and downloading modified LAS or LAZ files, only the much smaller LAY files need to be send back and forth.
First look at LASlayers
Download the current prototype and have a look at the ll.laz file with ‘lasview’:
C:\ll>lasview -i ll.laz
Now add the LASlayers contained in the ‘ll.lay’ file:
C:\ll>lasview -i ll.laz -ilay
Now put on layer by layer (or strip-off going in reverse):
C:\ll>lasview -i ll.laz -ilay 0 C:\ll>lasview -i ll.laz -ilay 1 C:\ll>lasview -i ll.laz -ilay 2 C:\ll>lasview -i ll.laz -ilay 3 C:\ll>lasview -i ll.laz -ilay 4
Now have a look at the LASlayers inside the ‘ll.lay’ file:
C:\ll>laslayers -i ll.laz LASlayer 1 of 4 start_position 276 size 258 type 16 (delete) fields 0 (n/a) compression 2 (pointwise) modification_mask 7352368 (system_identifier generating_software number_of_point_records number_of_points_by_return max_x min_x max_y min_y max_z min_z) ignore_mask 0 header_size 44 modification size 136 ignore size 0 description size 41 description lasnoise -i ll.laz -olay -remove_noise -v LASlayer 2 of 4 start_position 534 size 4302 type 1 (replace) fields 256 (classification) compression 2 (pointwise) modification_mask 48 (system_identifier generating_software) ignore_mask 0 header_size 44 modification size 64 ignore size 0 description size 37 description lasground -i ll.laz -ilay -fine -olay LASlayer 3 of 4 start_position 4836 size 4209 type 1 (replace) fields 256 (classification) compression 2 (pointwise) modification_mask 48 (system_identifier generating_software) ignore_mask 1 (classification 2) header_size 44 modification size 64 ignore size 4 description size 53 description lasclassify -i ll.laz -ilay -olay -rugged 2 -step 0.5 LASlayer 4 of 4 start_position 9045 size 552732 type 4 (add) fields 131072 (RGB) compression 2 (pointwise) modification_mask 3120 (system_identifier generating_software point_data_format point_data_record_length) ignore_mask 0 header_size 44 modification size 67 ignore size 0 description size 47 description lascolor -i ll.laz -ilay -image ortho.tif -olay
Now apply all LASlayers to create a new ‘ll_lay4.laz’ file:
C:\ll>laslayers -i ll.laz -ilay -o ll_lay4.laz C:\ll>lasview -i ll_lay4.laz
Now apply only the first two LASlayers:
C:\ll>laslayers -i ll.laz -ilay 2 -o ll_lay2.laz C:\ll>lasview -i ll_lay2.laz
Work with LASlayers using LAStools
Imagine that we have obtained raw LAZ tiles and orthos from a customer and are now producing several requested products with LASlayers.
Delete isolated points with ‘lasnoise’:
C:\ll>lasnoise -i ll.laz -olay C:\ll>lasview -i ll.laz -ilay
Create a noise-free DSM with ‘las2dem’:
C:\ll>las2dem -i ll.laz -ilay -first_only -step 0.5 -hillshade -odix _dsm -opng
Ground classify the noise-free points with ‘lasground’:
C:\ll>lasground -i ll.laz -ilay -fine -olay C:\ll>laslayers -i ll.laz
Create a DTM with ‘las2dem’:
C:\ll>las2dem -i ll.laz -ilay -keep_class 2 -step 0.5 -hillshade -odix _dtm -opng
Compute the height of points above the ground and store an approximation to user_data with ‘lasheight’:
C:\ll>lasheight -i ll.laz -ilay -olay C:\ll>lasview -i ll.laz -ilay -color_by_user_data
Classify building and forest points with ‘lasclassify’:
C:\ll>lasclassify -i ll.laz -ilay -olay C:\ll>lasview -i ll.laz -ilay
We do not like the result and want to adapt some parameters. Therefore we delete the last layers with ‘laslayers’:
C:\ll>laslayers -i ll.laz C:\ll>laslayers -i ll.laz -del 4 C:\ll>laslayers -i ll.laz C:\ll>lasview -i ll.laz -ilay
Classify again using different parameters with ‘lasclassify’:
C:\ll>lasclassify -i ll.laz -ilay -olay -rugged 2 -step 0.5 C:\ll>laslayers -i ll.laz C:\ll>lasview -i ll.laz -ilay
Create raster only where high vegetation is with ‘las2dem’:
C:\ll>las2dem -i ll.laz -ilay -keep_class 5 -step 0.5 -kill 1.5 -false -odix _veg -opng
Color the points using an ortho TIF image with ‘lascolor’:
C:\ll>lascolor -i ll.laz -ilay -image ortho.tif -olay C:\ll>laslayers -i ll.laz C:\ll>lasview -i ll.laz -ilay
Create LASlayers difference files
We were given a raw LAZ file and have created a modified LAZ file with a number of different tools. Now we want to produce a LAY file whose LASlayers express the difference between the two files. Why? Because in contrast to the LAZ file we can easily send the LAY file as an email attachement back to the customer. It is much more compact as it only stores only those parts that have actually changed.
Look at the modified LAZ file with ‘lasview’:
C:\ll>lasview -i ll_modified.laz
Create LASlayers that express the difference to the raw file with ‘laslayers’:
C:\ll>laslayers -i ll.laz -i ll_modified.laz -olay C:\ll>laslayers -i ll.laz C:\ll>lasview -i ll.laz -ilay C:\ll>lasview -i ll.laz -ilay 1 C:\ll>lasview -i ll.laz -ilay 2 C:\ll>lasview -i ll.laz -ilay 3
Apply LASlayers to the raw file to produce the modified one with ‘laslayers’.
C:\ll>laslayers.exe -i ll.laz -ilay -o ll_applied.laz C:\ll>lasview -i ll_applied.laz
Make sure the two are identical with ‘lasdiff’:
C:\ll>lasdiff -i ll_modified.laz -i ll_applied.laz
Now try on your own data and please report bugs, suggestions, and missing features.