1r.in.xyz(1) Grass User's Manual r.in.xyz(1)
2
3
4
6 r.in.xyz - Create a raster map from an assemblage of many coordinates
7 using univariate statistics.
8
10 raster
11
13 r.in.xyz
14 r.in.xyz help
15 r.in.xyz [-sg] input=name output=name [method=string] [type=string]
16 [fs=character] [x=integer] [y=integer] [z=integer]
17 [zrange=min,max] [percent=integer] [--overwrite]
18
19 Flags:
20 -s Scan data file for extent then exit
21
22 -g In scan mode, print using shell script style
23
24 --overwrite
25
26 Parameters:
27 input=name
28 ASCII file containing input data
29
30 output=name
31 Name for output raster map
32
33 method=string
34 Statistic to use for raster values Options:
35 n,min,max,range,sum,mean,stddev,variance,coeff_var Default: mean
36
37 type=string
38 Storage type for resultant raster map Options: CELL,FCELL,DCELL
39 Default: FCELL
40
41 fs=character
42 Field separator Default: |
43
44 x=integer
45 Column number of x coordinates in input file (first column is 1)
46 Default: 1
47
48 y=integer
49 Column number of y coordinates in input file Default: 2
50
51 z=integer
52 Column number of data values in input file Default: 3
53
54 zrange=min,max
55 Filter range for z data (min,max)
56
57 percent=integer
58 Percent of map to keep in memory Options: 1-100 Default: 100
59
61 The r.in.xyz module will load and bin ungridded x,y,z ASCII data into a
62 new raster map. The user may choose from a variety of statistical meth‐
63 ods in creating the new raster.
64
65 r.in.xyz is designed for processing massive point cloud datasets, for
66 example raw LIDAR or sidescan sonar swath data.
67
68 Available statistics for populating the raster are:
69 | n number of points in cell | min minimum value of
70 points in cell | max maximum value of points in cell |
71 range range of points in cell | sum sum of points in
72 cell | mean average value of points in cell | stddev stan‐
73 dard deviation of points in cell | variance variance of points
74 in cell | coeff_var coefficient of variance of points in cell
75
76 Variance and derivatives use the biased estimator (n).
77 [subject to change]
78
79 Coefficient of variance is given in percentage and
80 defined as (stddev/mean)*100.
81
83 Memory use
84 While the input file can be arbitrarily large, r.in.xyz will use a
85 large amount of system memory for large raster regions (10000x10000).
86 If the module refuses to start complaining that there isn't enough mem‐
87 ory, use the percent parameter to run the module in several passes. In
88 addition using a less precise map format (CELL [integer] or FCELL
89 [floating point]) will use less memory than a DCELL [double precision
90 floating point] output map. Methods such as n, min, max, sum will also
91 use less memory, while stddev, variance, and coeff_var will use more.
92 The default map type=FCELL is intended as compromise between preserving
93 data precision and limiting system resource consumption.
94
95 Setting region bounds and resolution
96 You can use the -s scan flag to find the extent of the input data (and
97 thus point density) before performing the full import. Use g.region to
98 adjust the region bounds to match. The -g shell style flag prints the
99 extent suitable as parameters for g.region. A suitable resolution can
100 be found by dividing the number of input points by the area covered.
101 e.g.
102 wc -l inputfile.txt
103 g.region -p
104 # points_per_cell = n_points / (rows * cols)
105 g.region -e
106 # UTM location:
107 # points_per_sq_m = n_points / (ns_extent * ew_extent)
108 # Lat/Lon location:
109 # points_per_sq_m = n_points / (ns_extent * ew_extent*cos(lat) *
110 (1852*60)^2)
111
112
113 If you only intend to interpolate the data with r.to.vect and
114 v.surf.rst, then there is little point to setting the region resolution
115 so fine that you only catch one data point per cell -- you might as
116 well use "v.in.ascii -zbt" directly.
117
118 Filtering
119 Points falling outside the current region will be skipped. This
120 includes points falling exactly on the southern region bound. (to cap‐
121 ture those adjust the region with "g.region s=s-0.000001"; see
122 g.region)
123
124 Blank lines and comment lines starting with the hash symbol (#) will be
125 skipped.
126
127 The zrange parameter may be used for filtering the input data by verti‐
128 cal extent. Example uses might include preparing multiple raster sec‐
129 tions to be combined into a 3D raster array with r.to.rast3, or for
130 filtering outliers on relatively flat terrain.
131
132 In varied terrain the user may find that min maps make for a good noise
133 filter as most LIDAR noise is from premature hits. The min map may also
134 be useful to find the underlying topography in a forested or urban
135 environment if the cells are over sampled.
136
137 The user can use a combination of r.in.xyz output maps to create custom
138 filters. e.g. use r.mapcalc to create a mean-(2*stddev) map. [In this
139 example the user may want to include a lower bound filter in r.mapcalc
140 to remove highly variable points (small n) or run r.neighbors to smooth
141 the stddev map before further use.]
142
143 Reprojection
144 If the raster map is to be reprojected, it may be more appropriate to
145 reproject the input points with m.proj or cs2cs before running
146 r.in.xyz.
147
148 Interpolation into a DEM
149 The vector engine's topographic abilities introduce a finite memory
150 overhead per vector point which will typically limit a vector map to
151 approximately 3 million points (~ 1750^2 cells). If you want more, use
152 the r.to.vect -b flag to skip building topology. Without topology, how‐
153 ever, all you'll be able to do with the vector map is display with
154 d.vect and interpolate with v.surf.rst. Run r.univar on your raster
155 map to check the number of non-NULL cells and adjust bounds and/or res‐
156 olution as needed before proceeding.
157
158 Typical commands to create a DEM using a regularized spline fit:
159 r.univar lidar_min
160 r.to.vect -z feature=point in=lidar_min out=lidar_min_pt
161 v.surf.rst layer=0 in=lidar_min_pt elev=lidar_min.rst
162
163
165 Import the Jockey's Ridge, NC, LIDAR dataset, and process into a clean
166 DEM:
167 # scan and set region bounds
168 r.in.xyz -s fs=, in=lidaratm2.txt out=test
169 g.region n=35.969493 s=35.949693 e=-75.620999 w=-75.639999
170 g.region res=0:00:00.075 -a
171 # create "n" map containing count of points per cell for checking
172 density
173 r.in.xyz in=lidaratm2.txt out=lidar_n fs=, method=n zrange=-2,50
174 # check point density [rho = n_sum / (rows*cols)]
175 r.univar lidar_n | grep sum
176 # create "min" map (elevation filtered for premature hits)
177 r.in.xyz in=lidaratm2.txt out=lidar_min fs=, method=min zrange=-2,50
178 # zoom to area of interest
179 g.region n=35:57:56.25N s=35:57:13.575N w=75:38:23.7W e=75:37:15.675W
180 # check number of non-null cells (try and keep under a few million)
181 r.univar lidar_min | grep '^n:'
182 # convert to points
183 r.to.vect -z feature=point in=lidar_min out=lidar_min_pt
184 # interpolate using a regularized spline fit
185 v.surf.rst layer=0 in=lidar_min_pt elev=lidar_min.rst
186 # set color scale to something interesting
187 r.colors lidar_min.rst rule=bcyr
188 # prepare a 1:1:1 scaled version for NVIZ visualization (for
189 lat/lon input)
190 r.mapcalc "lidar_min.rst_scaled = lidar_min.rst / (1852*60)"
191 r.colors lidar_min.rst_scaled rule=bcyr
192
193
195 Support for advanced statistics (in parallel with r.uni‐
196 var). Especially useful for dealing with outliers would
197 be median and 5-10% trimmed means.
198 The equivalent module from GRASS 5 ( s.cellstats ) con‐
199 tains code for additional statistical options, claiming
200 to use only 16 bytes per cell: skewness, kurtosis, mean
201 of squares, mean of absolute values, first quartile,
202 median, third quartile.
203
204 Support for multiple map output from a single run.
205 method=string[,string,...] output=name[,name,...]
206
208 n map sum can be ever-so-slightly more than `wc -l` with
209 e.g. percent=10 or less.
210 Cause unknown.
211
212 n map percent=100 and percent=xx maps differ slightly
213 (point will fall above/below the segmentation line)
214 Investigate with "r.mapcalc diff=bin_n.100 - bin_n.33"
215 etc.
216 Cause unknown.
217
218 "nan" can leak into coeff_var maps.
219 Cause unknown. Possible work-around: "r.null setnull=nan"
220 If you encounter any problems (or solutions!) please contact the GRASS
221 Development Team.
222
224 g.region, m.proj, r.fillnulls, r.in.ascii, r.mapcalc, r.neighbors,
225 r.to.rast3, r.to.vect, r.univar, r.univar2, v.in.ascii, v.surf.rst
226
228 Hamish Bowman
229
230 Department of Marine Science
231 University of Otago
232 New Zealand
233
234 Last changed: $Date: 2006/06/17 06:23:49 $
235
236 Full index
237
238
239
240GRASS 6.2.2 r.in.xyz(1)