new: LASlayers with filters, transforms, and filtered transforms

234 views
Skip to first unread message

Martin Isenburg

unread,
Oct 16, 2016, 9:08:23 AM10/16/16
to LAStools - efficient command line tools for LIDAR processing
Hello,

following up on this discussion where Andrew asked for a better way to assign RGB values based on their classification


I would now like to show you how you can use LASlayers (starting with the newest version 161016) in combination with filters and transforms to achieve the same as before but with much less data stored to temporary files:

:: first we again create a file with colors

las2las -i ..\data\fusa.laz -set_point_type 3 -o fusaRGB.laz

:: then we make one filtered transform that colors the ground points
:: blue-ish but use laslayers with the new option '-add' to create a
:: new (tiny) LAY file instead of a new LAZ file

laslayers -i fusaRGB.laz ^
          -add ^
          -keep_class 2 ^
          -filtered_transform ^
          -set_RGB 50 255 255 ^
          -olay

:: print the contents of the new LAY file

laslayers -i fusaRGB.laz

LASlayer 1 of 1
  start_position           276
  size                     224
  type                     128 (transform)
  fields                     0 (all)
  compression                1 (none)
  modification_mask    7348224 (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         68
  ignore size                0
  description size          54
  description           -keep_class 2 -filtered_transform -set_RGB 50 255 255

:: look at the LAY file applied on the fly

lasview -i fusaRGB.laz -ilay

:: then we make one filtered transform that colors the building points
:: green-ish but use laslayers withoptions '-ilay' and '-add' to append
:: to the (tiny) LAY file instead of creating yet another LAZ file

laslayers -i fusaRGB.laz -ilay ^
              -add ^
              -keep_class 6 ^
              -filtered_transform ^
              -set_RGB 200 200 25 ^
              -olay

:: print the contents of the modified LAY file

laslayers -i fusaRGB.laz

LASlayer 1 of 2
  start_position           276
  size                     224
  type                     128 (transform)
  fields                     0 (all)
  compression                1 (none)
  modification_mask    7348224 (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         68
  ignore size                0
  description size          54
  description           -keep_class 2 -filtered_transform -set_RGB 50 255 255
LASlayer 2 of 2
  start_position           500
  size                     224
  type                     128 (transform)
  fields                     0 (all)
  compression                1 (none)
  modification_mask    7348224 (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         68
  ignore size                0
  description size          54
  description           -keep_class 6 -filtered_transform -set_RGB 200 200 25

:: look at the LAY file applied on the fly

lasview -i fusaRGB.laz -ilay

:: then we make one filtered transform that colors the veggie points
:: pink-ish but use laslayers withoptions '-ilay' and '-add' to append
:: to the (tiny) LAY file instead of creating yet another LAZ file

laslayers -i fusaRGB.laz -ilay ^
         -add ^
         -keep_class 5 ^
         -filtered_transform ^
         -set_RGB 250 25 125 ^
         -olay

:: print the contents of the modified LAY file

laslayers -i fusaRGB.laz

LASlayer 1 of 3
  start_position           276
  size                     224
  type                     128 (transform)
  fields                     0 (all)
  compression                1 (none)
  modification_mask    7348224 (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         68
  ignore size                0
  description size          54
  description           -keep_class 2 -filtered_transform -set_RGB 50 255 255
LASlayer 2 of 3
  start_position           500
  size                     224
  type                     128 (transform)
  fields                     0 (all)
  compression                1 (none)
  modification_mask    7348224 (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         68
  ignore size                0
  description size          54
  description           -keep_class 6 -filtered_transform -set_RGB 200 200 25
LASlayer 3 of 3
  start_position           724
  size                     224
  type                     128 (transform)
  fields                     0 (all)
  compression                1 (none)
  modification_mask    7348224 (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         68
  ignore size                0
  description size          54
  description           -keep_class 5 -filtered_transform -set_RGB 250 25 125

:: look at the LAY file applied on the fly

lasview -i fusaRGB.laz -ilay

:: apply the 3 LASlayers from the LAY file which is like the "flatten image"
:: operation in GIMP or Photoshop to create the final LAZ file (to deliver
:: to the customer).

laslayers -i fusaRGB.laz -ilay -o fusaRGBfinal.laz

:: look at the "flattened" LAZ file

lasview -i fusaRGBfinal.laz

The attached image shows the result of the last two lasview operations.

Regards,

Martin

PS: For more info on LASlayers see all these links


laslayers_with_filtered_transform_final.jpg

Sam Hackett

unread,
Jul 6, 2018, 1:39:30 AM7/6/18
to LAStools - efficient tools for LiDAR processing
Hey Guys,

Just sending out feedback on Laslayers;

I am currently processing a 195GB LAZ dataset.  The current phase of the workflow has 12 lastools processes.  Typically each of these would create a new version of the data. Conventionally this workflow would consume above 2.4TB of space, however by using laslayers in the workflow I am saving disk write time and have reduced the processing data volume to about 500GB.  This lets me run the whole project on a single 1TB SSD.

A few comments;
laslayers doesn't work with indexing or on-the-fly buffering so I have buffered the tiled dataset with an on-the fly buffering at the beginning of the workflow and include -remain_buffered.  This requires the output to be -olaz rather than -olay.

lastile can remove on-the-fly buffering with -remove_buffer.  This reverts the point data back to the initial tile boundary.

las2las doesn't interact with layers, so for simple transformations that would typically be done with las2las these need to be included in other tools in the workflow.  e.g. lasclassify and lasnoise are being used to also change classifications with -change_classification_from_to.


In my opinion using laslayers may cause a few small limitations/differences to the usual workflow however it will definitely improve performance for processing of large datasets.  The larger your dataset the more value you will get.  It also adds some tractability in the form of a processing record in the LAY file.


Happy processing

Sam
Reply all
Reply to author
Forward
0 new messages