las2las(1)

NAME
las2las - Advanced LAS filtering and manipulation

SYNOPSIS
las2las
[OPTIONS]

DESCRIPTION
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:

•   clipping of points to those that lie within a certain region specified by a bounding box (\FC--extent\F[])

•   eliminating points that are the second return (\FC--drop-return 2\F[]),

•   eliminating points that have a scan angle above some threshold (\FC--drop-scan-angle "<5"\F[])

•   eliminating points that have an intensity below some threshold (\FC--drop-intensity "<15"\F[])

•   extracting only first (\FC--first-only\F[]) or last (\FC--last-only\F[]) returns

•   changing the format from LAS 1.0 to 1.1 or vice versa

•   eliminating points of a given classification (\FC--eliminate class 2\F[])

las2las started a port of Martin Isenburg's las2las utility from to the libLAS library. It is much-improved from his version, however, and provides a number of additional capabilities.

See also. contains background information on the port of Isenburg and Shewchuck's utilities to the libLAS library.

•   Text output describing the operation(s) is only provided when the \FC--verbose\F[] (\FC-v\F[]) switch is provided. Errors are reported to stderr.

•   Coordinate reprojection, including vertical datum transformation when compiled with the latest .

•   Coordinate system description and alteration.

•   Variable Length Records (VLRs) are carried forward by default.

•   VLR alteration, including adding your own VLRs with files and removal of VLRs

•   File splitting based on a specified file size (\FC--split-mb\F[]) or points (\FC--split-pts\F[])

•   Ability to set coordinate offsets to minimum values of the existing coordinate space.

•   Color filtering

OPTIONS
las2las2 options:

\FC-h\F[], \FC--help\F[]
    produce help message

\FC--split-mb\F[] arg (=0)
    Split file into multiple files with each being this size in MB or less. If this value is 0, no splitting is done

\FC--split-pts\F[] arg (=0)
    Split file into multiple files with each being this many points or less. If this value is 0, no splitting is done

\FC-i\F[] arg, \FC--input\F[] arg
    input LAS file

\FC-o\F[] arg, \FC--output\F[] arg (=output.las)
    output LAS file

\FC-v\F[], \FC--verbose\F[]
    Verbose message output

Header modification options:

\FC--a_srs\F[] arg
    Coordinate system to assign to input LAS file

\FC--a_vertcs\F[] arg
    Override vertical coordinate system information. Use \FC--a_vertcs "verticalCSType [citation [verticalDatum [verticalUnits]]]"\F[] For example: \FC--a_vertcs 5703 "North American Vertical Datum of 1988 (NAVD88)" 5103 9001\F[]

\FC--offset\F[] arg
    A comma-separated or quoted, space-separated list of offsets to set on the output file: \FC--offset 0,0,0\F[] \FC--offset "1234 5678 91011"\F[]

\FC--scale\F[] arg
    A list of scales to set on the output file. Scales cannot be negative, and should always be a negative power of 10: \FC--scale 0.1 0.1 0.00001\F[]

\FC-f\F[] arg, \FC--file-format\F[] arg
    Set the LAS format of the new file (only 1.0-1.2 supported at this time): \FC--file-format 1.2\F[] \FC-f 1.1\F[]

\FC--point-format\F[] arg
    Set the LAS point format of the new file (0, 1, 2, 3): \FC--point-format 3\F[]

\FC--pad-header\F[] arg
    Add extra bytes to the existing header

\FC--min-offset\F[]
    Set the offset of the header to the minimums of all values in the file. Note that this requires multiple read passes through the file to achieve.

\FC--file-creation\F[] arg
    Set the header's day/year. Specify either as "1 2010" for the first day of 2010, or as "now" to specify the current day/year

\FC--add-schema\F[]
    Add the liblas.org schema VLR record to the file.

\FC--delete-vlr\F[] arg
    Removes VLRs with the given name and id combination. \FC--delete-vlr LASF_Projection 34737\F[]

\FC--add-vlr\F[] arg
    Add VLRs with the given name and id combination. \FC--add-vlr hobu 1234 "Description of the VLR" "filename.ext"\F[]

\FC--system-identifier\F[] arg
    Set the SystemID for the file. \FC--system-identifier "MODIFICATION"\F[]

\FC--generating-software\F[] arg
    Set the SoftwareID for the file. \FC--generating-software "liblas.org"\F[]

Transformation options:

\FC--t_srs\F[] arg
    Coordinate system to reproject output LAS file to. Use \FC--a_srs\F[] or verify that your input LAS file has a coordinate system according to lasinfo

\FC--point-translate\F[] arg
    An expression to translate the X, Y, Z values of the point. For example, converting Z units that are in meters to feet: \FC--point-translate "x*1.0 y*1.0 z*3.2808399"\F[]

\FC--color-source\F[] arg
    A string to a GDAL-openable raster data source. Use GDAL VRTs if you want to adjust the data source or set its coordinate system, etc. \FC--color-source "afile.tif"\F[]

\FC--color-source-bands\F[] arg
    A list of three bands from the \FC--color-source\F[] to assign to the R, G, B values for the point \FC--color-source-bands 1 2 3\F[]

\FC--color-source-scale\F[] arg
    A number used by \FC--color-source\F[] to scale the input R, G, B values for the point. For example, to scale the 8 bit color data from an input raster to 16 bit, the 8 bit data should be multiplied by 257. \FC--color-source-scale 256\F[]

Filtering options:

\FC-e\F[] arg, \FC--extent\F[] arg
    Extent window that points must fall within to keep. Use a comma-separated or quoted, space-separated list, for example, \FC-e minx, miny, maxx, maxy\F[] or \FC-e minx, miny, minz, maxx, maxy, maxz\F[] \FC-e "minx miny minz maxx maxy maxz"\F[]

\FC--minx\F[] arg
    Extent must be greater than or equal to minx to be kept. \FC--minx 1234.0\F[]

\FC--miny\F[] arg
    Extent must be greater than or equal to miny to be kept. \FC--miny 5678.0\F[]

\FC--minz\F[] arg
    Extent must be greater than or equal to minz to be kept. If maxx and maxy are set but not minz *and maxz, all z values are kept. \FC--minz 0.0\F[]

\FC--maxx\F[] arg
    Extent must be less than or equal to maxx to be kept. \FC--maxx 1234.0\F[]

\FC--maxy\F[] arg
    Extent must be less than or equal to maxy to be kept. \FC--maxy 5678.0\F[]

\FC--maxz\F[] arg
    Extent must be less than or equal to maxz to be kept. If maxx and maxy are set but not maxz *and minz, all z values are kept. \FC--maxz 10.0\F[]

\FC-t\F[] arg, \FC--thin\F[] arg (=0)
    Simple decimation-style thinning. Thin the file by removing every t'th point from the file.

\FC--last-return-only\F[]
    Keep last returns (cannot be used with \FC--first-return-only\F[])

\FC--first-return-only\F[]
    Keep first returns (cannot be used with \FC--last-return-only\F[])

\FC--keep-returns\F[] arg
    A list of return numbers to keep in the output file: \FC--keep-returns 1 2 3\F[]

\FC--drop-returns\F[] arg
    Return numbers to drop. For example, \FC--drop-returns 2 3 4 5\F[]

\FC--valid_only\F[]
    Keep only valid points

\FC--keep-classes\F[] arg
    A list of classifications to keep: \FC--keep-classes 2 4 12\F[] \FC--keep-classes 2\F[]

\FC--drop-classes\F[] arg
    A comma-separated list of classifications to drop: \FC--drop-classes 1,7,8\F[] \FC--drop-classes 2\F[]

\FC--keep-intensity\F[] arg
    Range in which to keep intensity. The following expression types are supported: \FC--keep-intensity 0-100\F[] \FC--keep-intensity <200\F[] \FC--keep-intensity >400\F[] \FC--keep-intensity >=200\F[]

\FC--drop-intensity\F[] arg
    Range in which to drop intensity. The following expression types are supported: \FC--drop-intensity <200 \F[] \FC--drop-intensity >400 \F[] \FC--drop-intensity >=200\F[]

\FC--keep-time\F[] arg
    Range in which to keep time. The following expression types are supported: \FC--keep-time 413665.2336-414092.8462\F[] \FC--keep-time <414094.8462\F[] \FC--keep-time >413665.2336\F[] \FC--keep-time >=413665.2336\F[]

\FC--drop-time\F[] arg
    Range in which to drop time. The following expression types are supported: \FC--drop-time <413666.2336 \F[] \FC--drop-time >413665.2336 \F[] \FC--drop-time >=413665.2336\F[]

\FC--keep-scan-angle\F[] arg
    Range in which to keep scan angle. The following expression types are supported: \FC--keep-scan-angle 0-100\F[] \FC--keep-scan-angle <100\F[] \FC--keep-scan-angle <=100\F[]

\FC--drop-scan-angle\F[] arg
    Range in which to drop scan angle. The following expression types are supported: \FC--drop-scan-angle <30\F[] \FC--drop-scan-angle >100\F[] \FC--drop-scan-angle >=100\F[]

\FC--keep-color\F[] arg
    Range in which to keep colors. Define colors as two 3-tuples (R,G,B-R,G,B): \FC--keep-color '0,0,0-125,125,125'\F[]

\FC--drop-color\F[] arg
    Range in which to drop colors. Define colors as two 3-tuples (R,G,B-R,G,B): \FC--drop-color '255,255,255-65536,65536,65536'\F[]

For more information, see the full documentation for las2las2 at: ⟨http://liblas.org/utilities/las2las2.html⟩

EXAMPLE
Clipping with a rectangle

\FC
$ las2las in.las --output out.las --extent "63025000 483450000 63050000 483475000"
      \F[]

clips points of in.las with x<=63025000 and y<=483450000 or x>=63050000 and y>=483475000 and stores surviving points to out.las.

\FC
$ las2las in.las --output out.las --extent "63025000 483450000 0 63050000 483475000 100""
      \F[]

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 \FC--extent\F[] parameters to avoid quoting.

Eliminating specified returns

\FC
$ las2las --input in.las --output out.las --drop-returns 1
      \F[]

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.

\FC
$ las2las --input in.las --output out.las --drop-returns 2 3 4 5
      \F[]

eliminates all returns in the specified list.

Limiting based on scan angle

\FC
$ las2las --input in.las --output out.las --keep-scan-angle "<=15"
      \F[]

keeps all points of in.las whose scan angle is <= 15.

Limiting based on intensity

\FC
$ las2las --input in.las --output out.las --drop-intensity "<=1000"
      \F[]

eliminates all points of in.las whose intensity is below 1000 and stores surviving points to out.las.

Extract last returns

\FC
$ las2las --input in.las --output out.las --last-return-only
      \F[]

extracts all last return points from in.las and stores them to out.las.

Throw out invalid data

\FC
$ las2las --input in.las --output out.las --valid-only
      \F[]

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

\FC
$ las2las --input in.las --output out.las --drop-classes 2
      \F[]

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

\FC
$ las2las --input in.las --output out.las --drop-classes 1 2
      \F[]

removes points that have a classification of 1 or 2.

Convert to 1.1

\FC
$ las2las --input in.las --output out.las --format 1.1
      \F[]

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

\FC
$ las2las in.las --a_vertcs 5703 "North American Vertical Datum of 1988 (NAVD88)" 5103 9001
      \F[]

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 \FC--a_srs\F[] and \FC--t_srs\F[] to do perform reprojection of the file.

File splitting

\FC
$ las2las in.las --split-mb 10
      \F[]

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.

\FC
$ las2las in.las --split-pts 100000
      \F[]

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. \FC--split-mb\F[] and \FC--split-pts\F[] will not work exactly with \FC--min-offset\F[]. \FC--min-offset\F[] will take the minimum offsets of the entire file, not each individual file that is a result of the split.

VLR addition

\FC
$ las2las in.las --add-vlr CUSTOM_VLR 42 "A VLR description" "myfile.ext"
      \F[]

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

\FC
$ las2las in.las --delete-vlr CUSTOM_VLR 42
      \F[]

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 \FCinput.las\F[] file, sets its format to \FC1.2\F[], and sets the point format to \FC3\F[] 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 \FC--color-source-scale\F[] factor or 256 to rescale the 8 bit image data to 16 bit color data.

\FC
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
      \F[]

note. If the coordinate system of \FCimage.img\F[] 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 for more detail.

warning. support must be enabled for this to work.