GRASS logo

Note: A new GRASS GIS stable version has been released: GRASS GIS 7.4, available here.
Updated manual page: here

NAME

r.in.lidar - Creates a raster map from LAS LiDAR points using univariate statistics.

KEYWORDS

raster, import, LIDAR

SYNOPSIS

r.in.lidar
r.in.lidar --help
r.in.lidar [-peosgi] input=name output=name [method=string] [type=string] [zrange=min,max] [zscale=float] [percent=integer] [pth=integer] [trim=float] [resolution=float] [return_filter=string] [class_filter=integer[,integer,...]] [--overwrite] [--help] [--verbose] [--quiet] [--ui]

Flags:

-p
Print LAS file info and exit
-e
Extend region extents based on new dataset
-o
Override dataset projection (use location's projection)
-s
Scan data file for extent then exit
-g
In scan mode, print using shell script style
-i
Import intensity values rather than z values
--overwrite
Allow output files to overwrite existing files
--help
Print usage summary
--verbose
Verbose module output
--quiet
Quiet module output
--ui
Force launching GUI dialog

Parameters:

input=name [required]
LAS input file
LiDAR input files in LAS format (*.las or *.laz)
output=name [required]
Name for output raster map
method=string
Statistic to use for raster values
Options: n, min, max, range, sum, mean, stddev, variance, coeff_var, median, percentile, skewness, trimmean
Default: mean
type=string
Storage type for resultant raster map
Options: CELL, FCELL, DCELL
Default: FCELL
zrange=min,max
Filter range for z data (min,max)
zscale=float
Scale to apply to z data
Default: 1.0
percent=integer
Percent of map to keep in memory
Options: 1-100
Default: 100
pth=integer
pth percentile of the values
Options: 1-100
trim=float
Discard <trim> percent of the smallest and <trim> percent of the largest observations
Options: 0-50
resolution=float
Output raster resolution
return_filter=string
Only import points of selected return type
If not specified, all points are imported
Options: first, last, mid
class_filter=integer[,integer,...]
Only import points of selected class(es)
Input is comma separated integers. If not specified, all points are imported.

Table of contents

DESCRIPTION

The r.in.lidar module loads and bins LAS LiDAR point clouds into a new raster map. The user may choose from a variety of statistical methods in creating the new raster.

Since the creation of raster maps depends on the computational region settings (extent and resolution), as default the current region extents and resolution are used for the import. When using the -e flag along with the resolution=value parameter, the region extents will be based on new dataset. It is therefore recommended to first use the -s flag to get the extents of the LiDAR point cloud to be imported, then adjust the current region extent and resolution accordingly, and only then proceed with the actual import. Another option is to automatically set the region extents based on the LAS dataset itself along with the desired raster resolution. See below for details.

r.in.lidar is designed for processing massive point cloud datasets, for example raw LiDAR or sidescan sonar swath data. It has been tested with large datasets (see below for memory management notes).

Available statistics for populating the output raster map are:


NOTES

LAS file import preparations

Since the r.in.lidar generates a raster map through binning from the original LiDAR points, the target computational region extent and resolution have to be determined. A typical workflow would involve the examination of the LAS data's associated documentation or the scan of the LAS data file with r.in.lidar's -s (or -g) flag to find the input data's bounds.
Another option is to automatically set the region extents based on the LAS dataset extent (-e flag) along with the desired raster resolution using the resolution parameter.

Memory use

While the input file can be arbitrarily large, r.in.lidar will use a large amount of system memory (RAM) for large raster regions (> 10000x10000 pixels). If the module refuses to start complaining that there isn't enough memory, use the percent parameter to run the module in several passes. In addition using a less precise map format (CELL [integer] or FCELL [floating point]) will use less memory than a DCELL [double precision floating point] output map. Methods such as n, min, max, sum will also use less memory, while stddev, variance, and coeff_var will use more. The aggregate functions median, percentile, skewness and trimmed mean will use even more memory and may not be appropriate for use with arbitrarily large input files.

A LiDAR pulse can have multiple returns. The first return values can be used to obtain a digital surface model (DSM) where e.g. canopy cover is represented. The last return values can be used to obtain a digital terrain model (DTM) where e.g. the forest floor instead of canopy cover is represented. The return_filter option allows selecting one of first, mid, or last returns.

LiDAR points can be already classified into standardized classes. For example, class number 2 represents ground (for other classes see LAS format specification in references). The class_filter option allows selecting one or more classes, as numbers (integers) separated by comma.

The default map type=FCELL is intended as compromise between preserving data precision and limiting system resource consumption.

Setting region bounds and resolution

Using the -s scan flag, the extent of the input data (and thus point density) is printed. To check this is recommended before performing the full import. The -g shell style flag prints the extent suitable as command line parameters for g.region.
A simpler option is to automatically set the region extents based on the LAS dataset (-e flag) along with the target raster resolution using the resolution parameter. Also here it is recommended to verify and optimize the resulting region settings with g.region prior to importing the dataset.

For the output raster map, a suitable resolution can be found by dividing the number of input points by the area covered (this requires an iterative approach as outlined here):

# print LAS metadata (Number of Points)
r.in.lidar -p input=points.las
#   Number of Point Records: 1287775

# scan for LAS points cloud extent
r.in.lidar -sg input=points.las output=dummy -o
# n=2193507.740000 s=2190053.450000 e=6070237.920000 w=6066629.860000 b=-3.600000 t=906.000000

# set computation region to this extent
g.region n=2193507.740000 s=2190053.450000 e=6070237.920000 w=6066629.860000 -p

# print resulting extent
g.region -p
#  rows:       3454
#  cols:       3608

# points_per_cell = n_points / (rows * cols)
# Here: 1287775 / (3454 * 3608) = 0.1033359 LiDAR points/raster cell
# As this is too low, we need to select a lower raster resolution

g.region res=5 -ap
#  rows:       692
#  cols:       723
#  Now: 1287775 / (692 * 723) = 2.573923 LiDAR points/raster cell

# import as mean
r.in.lidar input=points.las output=lidar_dem_mean method=mean -o

# import as max
r.in.lidar input=points.las output=lidar_dem_max method=max -o

# import as p'th percentile of the values
r.in.lidar input=points.las output=lidar_dem_percentile_95 \
           method=percentile pth=95 -o
Mean value DEM in perspective view
Mean value DEM in perspective view, imported from LAS file

Further hints: how to calculate number of LiDAR points/square meter:

g.region -e
  # Metric location:
  # points_per_sq_m = n_points / (ns_extent * ew_extent)

  # Lat/Lon location:
  # points_per_sq_m = n_points / (ns_extent * ew_extent*cos(lat) * (1852*60)^2)

Filtering

Points falling outside the current region will be skipped. This includes points falling exactly on the southern region bound. (to capture those adjust the region with "g.region s=s-0.000001"; see g.region)

Blank lines and comment lines starting with the hash symbol (#) will be skipped.

The zrange parameter may be used for filtering the input data by vertical extent. Example uses might include preparing multiple raster sections to be combined into a 3D raster array with r.to.rast3, or for filtering outliers on relatively flat terrain.

In varied terrain the user may find that min maps make for a good noise filter as most LIDAR noise is from premature hits. The min map may also be useful to find the underlying topography in a forested or urban environment if the cells are oversampled.

The user can use a combination of r.in.lidar output maps to create custom filters. e.g. use r.mapcalc to create a mean-(2*stddev) map. [In this example the user may want to include a lower bound filter in r.mapcalc to remove highly variable points (small n) or run r.neighbors to smooth the stddev map before further use.]

EXAMPLE

Import of a LAS file into an existing location/mapset (metric):
# set the computational region automatically, resol. for binning is 5m
r.in.lidar -e -o input=points.las resolution=5 output=lidar_dem_mean
g.region raster=lidar_dem_mean -p
r.univar lidar_dem_mean

Serpent Mound dataset: This example is analogous to the example used in the GRASS wiki page for importing LAS as raster DEM.

The sample LAS data are in the file "Serpent Mound Model LAS Data.las", available at appliedimagery.com

# print LAS file info
r.in.lidar -p input="Serpent Mound Model LAS Data.las"

# using v.in.lidar to create a new location
# create location with projection information of the LAS data
v.in.lidar -i input="Serpent Mound Model LAS Data.las" location=Serpent_Mound

# quit and restart GRASS in the newly created location "Serpent_Mound"

# scan the extents of the LAS data
r.in.lidar -sg input="Serpent Mound Model LAS Data.las"

# set the region to the extents of the LAS data, align to resolution
g.region n=4323641.57 s=4320942.61 w=289020.90 e=290106.02 res=1 -ap

# import as raster DEM
r.in.lidar input="Serpent Mound Model LAS Data.las" \
           output=Serpent_Mound_Model_LAS_Data method=mean

NOTES

The typical file extensions for the LAS format are .las and .laz (compressed). The compressed LAS (.laz) format can be imported only if libLAS has been compiled with laszip support. It is also recommended to compile libLAS with GDAL, needed to test for matching projections.

TODO

KNOWN ISSUES

If you encounter any problems (or solutions!) please contact the GRASS Development Team.

SEE ALSO

g.region, r.in.xyz, r.mapcalc, r.univar, v.in.lidar
v.lidar.correction, v.lidar.edgedetection, v.lidar.growing, v.outlier, v.surf.bspline

REFERENCES

ASPRS LAS format
LAS library
LAS library C API documentation

AUTHORS

Markus Metz
based on r.in.xyz by Hamish Bowman and Volker Wichmann

Last changed: $Date: 2016-02-24 05:28:49 -0800 (Wed, 24 Feb 2016) $

SOURCE CODE

Available at: r.in.lidar source code (history)


Note: A new GRASS GIS stable version has been released: GRASS GIS 7.4, available here.
Updated manual page: here

Main index | Raster index | Topics index | Keywords index | Full index

© 2003-2018 GRASS Development Team, GRASS GIS 7.0.7svn Reference Manual