las2las(1) | las2las(1) |
las2las - Advanced LAS filtering and manipulation
las2las
[OPTIONS]
las2las reads and writes LiDAR data in the ASPRS LAS 1.0, 1.1, and 1.2 formats while modifying its contents. las2las is designed for filtering and transformation operations of LAS files.
While lasinfo(1), can do a few simple operations like updating header information, more drastic changes, like removing points or altering values, will require las2las. las2las is expected to be used for modifying single files at a time, and some las2las operations require multiple read passes through the points. Some examples of operations las2las can be used for include:
las2las started a port of Martin Isenburg's las2las utility from LASTools ⟨http://www.cs.unc.edu/~isenburg/lastools/⟩ to the libLAS library. It is much-improved from his version, however, and provides a number of additional capabilities.
See also. libLAS’ Relationship to LAStools ⟨http://www.liblas.org/lastools.html#lastools-liblas⟩ contains background information on the port of Isenburg and Shewchuck's utilities to the libLAS library.
las2las2 options:
Header modification options:
Transformation options:
Filtering options:
For more information, see the full documentation for las2las2 at: ⟨http://liblas.org/utilities/las2las2.html⟩
Clipping with a rectangle
$ las2las in.las --output out.las --extent "63025000 483450000 63050000 483475000"
clips points of in.las with x<=63025000 and y<=483450000 or x>=63050000 and y>=483475000 and stores surviving points to out.las.
$ las2las in.las --output out.las --extent "63025000 483450000 0 63050000 483475000 100""
clips points of in.las with x <= 63025000 and y <= 483450000 and z <= 100 or x >= 63050000 and y >= 483475000 and z >= 0
note. The quotes around the extent values are important to aid the command line parsing. An error will likely result of not quoting the values. Alternatively, you can use commas to separate the --extent parameters to avoid quoting.
Eliminating specified returns
$ las2las --input in.las --output out.las --drop-returns 1
eliminates all points of in.las that are designated first returns by the value in their return_number field and stores surviving points to out.las.
$ las2las --input in.las --output out.las --drop-returns 2 3 4 5
eliminates all returns in the specified list.
Limiting based on scan angle
$ las2las --input in.las --output out.las --keep-scan-angle "<=15"
keeps all points of in.las whose scan angle is <= 15.
Limiting based on intensity
$ las2las --input in.las --output out.las --drop-intensity "<=1000"
eliminates all points of in.las whose intensity is below 1000 and stores surviving points to out.las.
Extract last returns
$ las2las --input in.las --output out.las --last-return-only
extracts all last return points from in.las and stores them to out.las.
Throw out invalid data
$ las2las --input in.las --output out.las --valid-only
removes invalid (according to the ASPRS LAS file format specification) points. This switch should only be required in a few special circumstances. Points that might be invalid include those with larger-than-required scan angles.
Eliminate ground points
$ las2las --input in.las --output out.las --drop-classes 2
removes points with that have a classification of 2. Points with a classification of 2 are conventionally called ground points, but that convention may not be followed for older LAS 1.0 files.
Eliminate ground and unclassified points
$ las2las --input in.las --output out.las --drop-classes 1 2
removes points that have a classification of 1 or 2.
Convert to 1.1
$ las2las --input in.las --output out.las --format 1.1
converts the in.las file to a 1.1-formatted file. For the most part, this conversion is "in name only."
Alter vertical datum information
$ las2las in.las --a_vertcs 5703 "North American Vertical Datum of 1988 (NAVD88)" 5103 9001
sets the vertical datum information for the file to be NAVD88 with vertical units of meters.
note. This may not be relevant depending upon the circumstances of the coordinate system the file is already in. This option only changes the *description* of the points. It does not reproject them in any way. Use a combination of --a_srs and --t_srs to do perform reprojection of the file.
File splitting
$ las2las in.las --split-mb 10
splits the file into the required number of output-n.las files. Other filters or operations may also be applied to the operation in combination with splitting. Each outputted file will have its extents and point counts properly set.
$ las2las in.las --split-pts 100000
splits the file into the required number of output-n.las files with 100000 points each in them. Other filters or operations may also be applied to the operation in combination with splitting. Each outputted file will have its extents and point counts properly set.
note. --split-mb and --split-pts will not work exactly with --min-offset. --min-offset will take the minimum offsets of the entire file, not each individual file that is a result of the split.
VLR addition
$ las2las in.las --add-vlr CUSTOM_VLR 42 "A VLR description" "myfile.ext"
adds a new VLR with name CUSTOM_VLR and an ID of 42. "myfile.ext" can either be a location to a file to read to write into the VLR, or properly escaped text that will be inserted directly into the VLR.
warning. VLRs have a size limitation of 65536 bytes. Files that are read or escaped arguments that are larger than 64k in size will cause an error to be thrown. Automatic truncation will not happen.
note. If you attempt to add VLRs with an ID of 34735, 34736, or 34737, your VLR will not be added. This is because libLAS expects to manage the GeoTIFF keys for you. You should use the SRS handling facilities if you need to set GeoTIFF keys instead of attempting to overwrite them directly.
VLR removal
$ las2las in.las --delete-vlr CUSTOM_VLR 42
removes all VLRs from in.las when writing the new output.las file.
Adding color from an image
It is possible to use las2las to set RGB color information from an image and set it on the points. This requires a rewrite of the file and in some cases will require changing both the format and point-format of the file. The following example takes the input.las file, sets its format to 1.2, and sets the point format to 3 so it can store color information. It also re-orders the color bands to have the 3rd band in the image be red, 1st band be green, and second band be blue. Additionally, the color values are then multiplied by the --color-source-scale factor or 256 to rescale the 8 bit image data to 16 bit color data.
las2las -i input.las \
--color-source image.img \
-o output.las \
--file-format 1.2 \
--point-format 3 \
--color-source-scale 256 \
--color-source-bands 3 1 2
note. If the coordinate system of image.img is not the same as the input coordinate system of the LAS file, you should use GDAL VRTs to cause the image to be warped and reprojected as part of the read process. See GDAL Virtual Format Tutorial ⟨http://www.gdal.org/gdal_vrttut.html⟩ for more detail.
warning. GDAL ⟨http://www.gdal.org⟩ support must be enabled for this to work.
16 February 2019 |