.TH r.in.xyz 1grass "" "GRASS 6.4.4" "Grass User's Manual" .SH NAME \fI\fBr.in.xyz\fR\fR - Create a raster map from an assemblage of many coordinates using univariate statistics. .SH KEYWORDS raster, import, LIDAR .SH SYNOPSIS \fBr.in.xyz\fR .br \fBr.in.xyz help\fR .br \fBr.in.xyz\fR [\-\fBsgi\fR] \fBinput\fR=\fIname\fR \fBoutput\fR=\fIname\fR [\fBmethod\fR=\fIstring\fR] [\fBtype\fR=\fIstring\fR] [\fBfs\fR=\fIcharacter\fR] [\fBx\fR=\fIinteger\fR] [\fBy\fR=\fIinteger\fR] [\fBz\fR=\fIinteger\fR] [\fBzrange\fR=\fImin,max\fR] [\fBzscale\fR=\fIfloat\fR] [\fBpercent\fR=\fIinteger\fR] [\fBpth\fR=\fIinteger\fR] [\fBtrim\fR=\fIfloat\fR] [\-\-\fBoverwrite\fR] [\-\-\fBverbose\fR] [\-\-\fBquiet\fR] .SS Flags: .IP "\fB\-s\fR" 4m .br Scan data file for extent then exit .IP "\fB\-g\fR" 4m .br In scan mode, print using shell script style .IP "\fB\-i\fR" 4m .br Ignore broken lines .IP "\fB\-\-overwrite\fR" 4m .br Allow output files to overwrite existing files .IP "\fB\-\-verbose\fR" 4m .br Verbose module output .IP "\fB\-\-quiet\fR" 4m .br Quiet module output .PP .SS Parameters: .IP "\fBinput\fR=\fIname\fR" 4m .br ASCII file containing input data (or "-" to read from stdin) .IP "\fBoutput\fR=\fIname\fR" 4m .br Name for output raster map .IP "\fBmethod\fR=\fIstring\fR" 4m .br Statistic to use for raster values .br Options: \fIn,min,max,range,sum,mean,stddev,variance,coeff_var,median,percentile,skewness,trimmean\fR .br Default: \fImean\fR .IP "\fBtype\fR=\fIstring\fR" 4m .br Storage type for resultant raster map .br Options: \fICELL,FCELL,DCELL\fR .br Default: \fIFCELL\fR .IP "\fBfs\fR=\fIcharacter\fR" 4m .br Field separator .br Special characters: newline, space, comma, tab .br Default: \fI|\fR .IP "\fBx\fR=\fIinteger\fR" 4m .br Column number of x coordinates in input file (first column is 1) .br Default: \fI1\fR .IP "\fBy\fR=\fIinteger\fR" 4m .br Column number of y coordinates in input file .br Default: \fI2\fR .IP "\fBz\fR=\fIinteger\fR" 4m .br Column number of data values in input file .br Default: \fI3\fR .IP "\fBzrange\fR=\fImin,max\fR" 4m .br Filter range for z data (min,max) .IP "\fBzscale\fR=\fIfloat\fR" 4m .br Scale to apply to z data .br Default: \fI1.0\fR .IP "\fBpercent\fR=\fIinteger\fR" 4m .br Percent of map to keep in memory .br Options: \fI1-100\fR .br Default: \fI100\fR .IP "\fBpth\fR=\fIinteger\fR" 4m .br pth percentile of the values .br Options: \fI1-100\fR .IP "\fBtrim\fR=\fIfloat\fR" 4m .br Discard percent of the smallest and percent of the largest observations .br Options: \fI0-50\fR .PP .SH DESCRIPTION The \fIr.in.xyz\fR module will load and bin ungridded x,y,z ASCII data 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. .PP \fIr.in.xyz\fR 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). .PP Available statistics for populating the raster are: .br .RS .br | \fIn\fR | number of points in cell .br | \fImin\fR | minimum value of points in cell .br | \fImax\fR | maximum value of points in cell .br | \fIrange\fR | range of points in cell .br | \fIsum\fR | sum of points in cell .br | \fImean\fR | average value of points in cell .br | \fIstddev\fR | standard deviation of points in cell .br | \fIvariance\fR | variance of points in cell .br | \fIcoeff_var\fR | coefficient of variance of points in cell .br | \fImedian\fR | median value of points in cell .br | \fIpercentile\fR | p\u\fIth\fR\d percentile of points in cell .br | \fIskewness\fR | skewness of points in cell .br | \fItrimmean\fR | trimmed mean of points in cell .br .IP \fIVariance\fR and derivatives use the biased estimator (n). [subject to change] .IP \fICoefficient of variance\fR is given in percentage and defined as (stddev/mean)*100. .RE .br .SH NOTES .SS Gridded data If data is known to be on a regular grid \fIr.in.xyz\fR 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 \fIr.in.xyz\fR's \fB-s\fR (or \fB-g\fR) 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 \fIg.region\fR, run \fIr.in.xyz\fR using the \fIn\fR method and verify that n=1 at all places. \fIr.univar\fR can help. Once you are confident that the region exactly matches the data proceed to run \fIr.in.xyz\fR using one of the \fImean, min, max\fR, or \fImedian\fR methods. With n=1 throughout, the result should be identical regardless of which of those methods are used. .SS Memory use While the \fBinput\fR file can be arbitrarily large, \fIr.in.xyz\fR 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 \fBpercent\fR 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] \fBoutput\fR map. Methods such as \fIn, min, max, sum\fR will also use less memory, while \fIstddev, variance, and coeff_var\fR will use more. The aggregate functions \fImedian, percentile, skewness\fR and \fItrimmed mean\fR will use even more memory and may not be appropriate for use with arbitrarily large input files. .PP The default map \fBtype\fR=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. .SS Setting region bounds and resolution You can use the \fB-s\fR scan flag to find the extent of the input data (and thus point density) before performing the full import. Use \fIg.region\fR to adjust the region bounds to match. The \fB-g\fR shell style flag prints the extent suitable as parameters for \fIg.region\fR. A suitable resolution can be found by dividing the number of input points by the area covered. e.g. \fC .DS .br wc \-l inputfile.txt .br g.region \-p .br # points_per_cell = n_points / (rows * cols) .br .br g.region \-e .br # UTM location: .br # points_per_sq_m = n_points / (ns_extent * ew_extent) .br .br # Lat/Lon location: .br # points_per_sq_m = n_points / (ns_extent * ew_extent*cos(lat) * (1852*60)^2) .br .DE \fR .PP If you only intend to interpolate the data with \fIr.to.vect\fR and \fIv.surf.rst\fR, 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. .SS Filtering Points falling outside the current region will be skipped. This includes points falling \fIexactly\fR on the southern region bound. (to capture those adjust the region with "g.region s=s-0.000001"; see \fIg.region\fR) .PP Blank lines and comment lines starting with the hash symbol (#) will be skipped. .PP The \fBzrange\fR 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 \fIr.to.rast3\fR, or for filtering outliers on relatively flat terrain. .PP In varied terrain the user may find that \fImin\fR maps make for a good noise filter as most LIDAR noise is from premature hits. The \fImin\fR map may also be useful to find the underlying topography in a forested or urban environment if the cells are over sampled. .PP The user can use a combination of \fIr.in.xyz\fR \fBoutput\fR maps to create custom filters. e.g. use \fIr.mapcalc\fR to create a mean-(2*stddev) map. [In this example the user may want to include a lower bound filter in \fIr.mapcalc\fR to remove highly variable points (small \fIn\fR) or run \fIr.neighbors\fR to smooth the stddev map before further use.] .SS Reprojection If the raster map is to be reprojected, it may be more appropriate to reproject the input points with \fIm.proj\fR or \fIcs2cs\fR before running \fIr.in.xyz\fR. .SS Interpolation into a DEM The vector engine's topographic abilities introduce a finite memory overhead per vector point which will typically limit a vector map to approximately 3 million points (~ 1750^2 cells). If you want more, use the \fIr.to.vect\fR \fB-b\fR flag to skip building topology. Without topology, however, all you'll be able to do with the vector map is display with \fId.vect\fR and interpolate with \fIv.surf.rst\fR. Run \fIr.univar\fR on your raster map to check the number of non-NULL cells and adjust bounds and/or resolution as needed before proceeding. .PP Typical commands to create a DEM using a regularized spline fit: \fC .DS .br r.univar lidar_min .br r.to.vect \-z feature=point in=lidar_min out=lidar_min_pt .br v.surf.rst layer=0 in=lidar_min_pt elev=lidar_min.rst .br .DE \fR .br .SH EXAMPLE Import the Jockey's Ridge, NC, LIDAR dataset, and process into a clean DEM: \fC .DS .br # scan and set region bounds .br r.in.xyz \-s fs=, in=lidaratm2.txt out=test .br g.region n=35.969493 s=35.949693 e=-75.620999 w=-75.639999 .br g.region res=0:00:00.075 \-a .br # create "n" map containing count of points per cell for checking density .br r.in.xyz in=lidaratm2.txt out=lidar_n fs=, method=n zrange=-2,50 .br # check point density [rho = n_sum / (rows*cols)] .br r.univar lidar_n | grep sum .br # create "min" map (elevation filtered for premature hits) .br r.in.xyz in=lidaratm2.txt out=lidar_min fs=, method=min zrange=-2,50 .br # zoom to area of interest .br g.region n=35:57:56.25N s=35:57:13.575N w=75:38:23.7W e=75:37:15.675W .br # check number of non-null cells (try and keep under a few million) .br r.univar lidar_min | grep '^n:' .br # convert to points .br r.to.vect \-z feature=point in=lidar_min out=lidar_min_pt .br # interpolate using a regularized spline fit .br v.surf.rst layer=0 in=lidar_min_pt elev=lidar_min.rst .br # set color scale to something interesting .br r.colors lidar_min.rst rule=bcyr \-n \-e .br # prepare a 1:1:1 scaled version for NVIZ visualization (for lat/lon input) .br r.mapcalc "lidar_min.rst_scaled = lidar_min.rst / (1852*60)" .br r.colors lidar_min.rst_scaled rule=bcyr \-n \-e .br .DE \fR .br .SH TODO .RS .IP Support for multiple map output from a single run. .br method=string[,string,...] output=name[,name,...] .RE .SH BUGS .RS .IP \fIn\fR map sum can be ever-so-slightly more than \(gawc \-l\(ga with e.g. percent=10 or less. .br Cause unknown. .IP \fIn\fR map percent=100 and percent=xx maps differ slightly (point will fall above/below the segmentation line) .br Investigate with "r.mapcalc diff=bin_n.100 - bin_n.33" etc. .br Cause unknown. .IP "nan" can leak into \fIcoeff_var\fR maps. .br Cause unknown. Possible work-around: "r.null setnull=nan" .RE If you encounter any problems (or solutions!) please contact the GRASS Development Team. .SH SEE ALSO \fI g.region .br m.proj .br r.fillnulls .br r.in.ascii .br r.mapcalc .br r.neighbors .br r.out.xyz .br r.to.rast3 .br r.to.vect .br r.univar .br v.in.ascii .br v.surf.rst .br .br v.lidar.correction, v.lidar.edgedetection, v.lidar.growing, v.outlier, v.surf.bspline \fR .PP \fIpv\fR - The UNIX pipe viewer utility .br .SH AUTHORS Hamish Bowman .br \fI Department of Marine Science .br University of Otago .br New Zealand\fR .br .br Extended by Volker Wichmann to support the aggregate functions \fImedian, percentile, skewness\fR and \fItrimmed mean\fR. .br .PP \fILast changed: $Date: 2012-06-20 11:33:07 +0200 (Wed, 20 Jun 2012) $\fR .PP Full index .PP © 2003-2014 GRASS Development Team