GRASS logo

NAME

r.in.lidar - Create 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 [-osg] input=name output=name [method=string] [type=string] [zrange=min,max] [zscale=float] [percent=integer] [pth=integer] [trim=float] [--overwrite] [--verbose] [--quiet]

Flags:

-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
--overwrite
Allow output files to overwrite existing files
--verbose
Verbose module output
--quiet
Quiet module output

Parameters:

input=name [required]
LiDAR LAS input file
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

DESCRIPTION

The r.in.lidar module will load and bin LAS LiDAR point clouds into a new raster map. The user may choose from a variety of statistical methods in creating the new raster. Gridded data provided as a stream of x,y,z points may also be imported.

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 datasets as large as tens of billion of points (705GB in a single file).

Available statistics for populating the raster are:


NOTES

Gridded data

If data is known to be on a regular grid r.in.lidar can reconstruct the map perfectly as long as some care is taken to set up the region correctly and that the data's native map projection is used. A typical method would involve determining the grid resolution either by examining the data's associated documentation or by studying the text file. Next scan the data with r.in.lidar's -s (or -g) flag to find the input data's bounds. GRASS uses the cell-center raster convention where data points fall within the center of a cell, as opposed to the grid-node convention. Therefore you will need to grow the region out by half a cell in all directions beyond what the scan found in the file. After the region bounds and resolution are set correctly with g.region, run r.in.lidar using the n method and verify that n=1 at all places. r.univar can help. Once you are confident that the region exactly matches the data proceed to run r.in.lidar using one of the mean, min, max, or median methods. With n=1 throughout, the result should be identical regardless of which of those methods are used.

Memory use

While the input file can be arbitrarily large, r.in.lidar will use a large amount of system memory for large raster regions (10000x10000). 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.

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

Setting region bounds and resolution

You can use the -s scan flag to find the extent of the input data (and thus point density) before performing the full import. Use g.region to adjust the region bounds to match. The -g shell style flag prints the extent suitable as parameters for g.region. A suitable resolution can be found by dividing the number of input points by the area covered. e.g.
  wc -l inputfile.txt
  g.region -p
  # points_per_cell = n_points / (rows * cols)

  g.region -e
  # UTM 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)

If you only intend to interpolate the data with r.to.vect and v.surf.rst, then there is little point to setting the region resolution so fine that you only catch one data point per cell -- you might as well use "v.in.ascii -zbt" directly.

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 over sampled.

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.]

Interpolation into a DEM

The vector engine's topological abilities introduce a finite memory overhead per vector point which will limit the size a vector map relative to available RAM. If you want more, use the r.to.vect -b flag to skip building topology. Without topology, however, all you'll be able to do with the vector map is display with d.vect and interpolate with v.surf.rst. Run r.univar on your raster map to check the number of non-NULL cells and adjust bounds and/or resolution as needed before proceeding.

Typical commands to create a DEM using a regularized spline fit:

  r.univar lidar_min
  r.to.vect -z feature=point in=lidar_min out=lidar_min_pt
  v.surf.rst layer=0 in=lidar_min_pt elev=lidar_min.rst
Typical commands to create a DEM using bsplines:
  r.resamp.bspline in=lidar_min out=lidar_min.bspline

EXAMPLE

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

  # using v.in.lidar to print file info and to create a new location

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

  # 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

TODO

BUGS

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

SEE ALSO

g.region
m.proj
r.in.xyz
r.fillnulls
r.in.ascii
r.mapcalc
r.neighbors
r.out.xyz
r.to.rast3
r.to.vect
r.univar
v.in.lidar
v.in.ascii
v.surf.rst

v.lidar.correction, v.lidar.edgedetection, v.lidar.growing, v.outlier, v.surf.bspline

pv - The UNIX pipe viewer utility

AUTHORS

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

Last changed: $Date: 2011-11-08 13:24:20 -0800 (Tue, 08 Nov 2011) $


Main index - Raster index - Full index

© 2003-2012 GRASS Development Team