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

Updated manual page: here

**-s**- Scan data file for extent then exit
**-g**- In scan mode, print using shell script style
**-i**- Ignore broken lines
**--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

**input**=*name***[required]**- ASCII file containing input data (or "-" to read from stdin)
**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* **n**: Number of points in cell**min**: Minimum value of point values in cell**max**: Maximum value of point values in cell**range**: Range of point values in cell**sum**: Sum of point values in cell**mean**: Mean (average) value of point values in cell**stddev**: Standard deviation of point values in cell**variance**: Variance of point values in cell**coeff_var**: Coefficient of variance of point values in cell**median**: Median value of point values in cell**percentile**: Pth (nth) percentile of point values in cell**skewness**: Skewness of point values in cell**trimmean**: Trimmed mean of point values in cell**separator**=*character*- Field separator
- Special characters: pipe, comma, space, tab, newline
- Default:
*pipe* **x**=*integer*- Column number of x coordinates in input file (first column is 1)
- Default:
*1* **y**=*integer*- Column number of y coordinates in input file
- Default:
*2* **z**=*integer*- Column number of data values in input file
- If a separate value column is given, this option refers to the z-coordinate column to be filtered by the zrange option
- Default:
*3* **skip**=*integer*- Number of header lines to skip at top of input file
- Default:
*0* **zrange**=*min,max*- Filter range for z data (min,max)
**zscale**=*float*- Scale to apply to z data
- Default:
*1.0* **value_column**=*integer*- Alternate column number of data values in input file
- If not given (or set to 0) the z-column data is used
- Default:
*0* **vrange**=*min,max*- Filter range for alternate value column data (min,max)
**vscale**=*float*- Scale to apply to alternate value column data
- Default:
*1.0* **type**=*string*- Type of raster map to be created
- Storage type for resultant raster map
- Options:
*CELL, FCELL, DCELL* - Default:
*FCELL* **CELL**: Integer**FCELL**: Single precision floating point**DCELL**: Double precision floating point**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*

Please note that the current region extents and resolution are used for
the import. It is therefore recommended to first use the **-s**
flag to get the extents of the input points to be imported, then
adjust the current region accordingly, and only then proceed with the
actual import.

*r.in.xyz* 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 (**method**):

nnumber of points in cell minminimum value of points in cell maxmaximum value of points in cell rangerange of points in cell sumsum of points in cell meanaverage value of points in cell stddevstandard deviation of points in cell variancevariance of points in cell coeff_varcoefficient of variance of points in cell medianmedian value of points in cell percentilep ^{th}percentile of points in cellskewnessskewness of points in cell trimmeantrimmed mean of points in cell

*Variance*and derivatives use the biased estimator (n). [subject to change]*Coefficient of variance*is given in percentage and defined as`(stddev/mean)*100`.

It is also possible to bin and store another data column (e.g. backscatter) while simultaneously filtering and scaling both the data column values and the z range.

The default map **type**=`FCELL` is intended as compromise between
preserving data precision and limiting system resource consumption.
If reading data from a `stdin` stream, the program can only run using
a single pass.

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.

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

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

r.univar lidar_min r.to.vect -z type=point in=lidar_min out=lidar_min_pt v.surf.rst in=lidar_min_pt elev=lidar_min.rst

Note: if the z column is separated by several spaces from the coordinate columns,
it may be sufficient to adapt the **z** position value.

# Important: observe the raster spacing from the ASCII file: # ASCII file format (example): # 630007.5 228492.5 141.99614 # 630022.5 228492.5 141.37904 # 630037.5 228492.5 142.29822 # 630052.5 228492.5 143.97987 # ... # In this example the distance is 15m in x and y direction. # detect extent, print result as g.region parameters r.in.xyz input=elevation.xyz separator=space -s -g # ... n=228492.5 s=215007.5 e=644992.5 w=630007.5 b=55.578793 t=156.32986 # set computational region, along with the actual raster resolution # as defined by the point spacing in the ASCII file: g.region n=228492.5 s=215007.5 e=644992.5 w=630007.5 res=15 -p # now enlarge computational region by half a raster cell (here 7.5m) to # store the points as cell centers: g.region n=n+7.5 s=s-7.5 w=w-7.5 e=e+7.5 -p # import XYZ ASCII file, with z values as raster cell values r.in.xyz input=elevation.xyz separator=space method=mean output=myelev # univariate statistics for verification of raster values r.univar myelev

# scan and set region bounds r.in.xyz -s -g separator="," in=lidaratm2.txt g.region n=35.969493 s=35.949693 e=-75.620999 w=-75.639999 g.region res=0:00:00.075 -a # create "n" map containing count of points per cell for checking density r.in.xyz in=lidaratm2.txt out=lidar_n separator="," method=n zrange=-2,50 # check point density [rho = n_sum / (rows*cols)] r.univar lidar_n # create "min" map (elevation filtered for premature hits) r.in.xyz in=lidaratm2.txt out=lidar_min separator="," method=min zrange=-2,50 # set computational region to area of interest g.region n=35:57:56.25N s=35:57:13.575N w=75:38:23.7W e=75:37:15.675W # check number of non-null cells (try and keep under a few million) r.univar lidar_min # convert to points r.to.vect -z type=point in=lidar_min out=lidar_min_pt # interpolate using a regularized spline fit v.surf.rst in=lidar_min_pt elev=lidar_min.rst # set color scale to something interesting r.colors lidar_min.rst rule=bcyr -n -e # prepare a 1:1:1 scaled version for NVIZ visualization (for lat/lon input) r.mapcalc "lidar_min.rst_scaled = lidar_min.rst / (1852*60)" r.colors lidar_min.rst_scaled rule=bcyr -n -e

- Support for multiple map output from a single run.

`method=string[,string,...] output=name[,name,...]`

This can be easily handled by a wrapper script, with the added benefit of it being very simple to parallelize that way.

- "
`nan`" can leak into*coeff_var*maps.

Cause unknown. Possible work-around: "`r.null setnull=nan`"

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

*pv*
- The UNIX pipe viewer utility

Overview: Interpolation and Resampling in GRASS GIS

Extended by Volker Wichmann to support the aggregate functions

*Last changed: $Date: 2017-01-09 04:05:33 -0800 (Mon, 09 Jan 2017) $*

Available at: r.in.xyz 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 | Graphical index | Full index

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