1gdal_grid(1)                General Commands Manual               gdal_grid(1)
2
3
4

NAME

6       gdal_gridCreates regular grid from the scattered data.
7

SYNOPSIS

9       gdal_grid [-ot {Byte/Int16/UInt16/UInt32/Int32/Float32/Float64/
10                 CInt16/CInt32/CFloat32/CFloat64}]
11                 [-of format] [-co "NAME=VALUE"]
12                 [-zfield field_name] [-z_increase increase_value] [-z_multiply multiply_value]
13                 [-a_srs srs_def] [-spat xmin ymin xmax ymax]
14                 [-clipsrc <xmin ymin xmax ymax>|WKT|datasource|spat_extent]
15                 [-clipsrcsql sql_statement] [-clipsrclayer layer]
16                 [-clipsrcwhere expression]
17                 [-l layername]* [-where expression] [-sql select_statement]
18                 [-txe xmin xmax] [-tye ymin ymax] [-outsize xsize ysize]
19                 [-a algorithm[:parameter1=value1]*] [-q]
20                 <src_datasource> <dst_filename>
21

DESCRIPTION

23       This program creates regular grid (raster) from the scattered data read
24       from the OGR datasource. Input data will be interpolated to fill grid
25       nodes with values, you can choose from various interpolation methods.
26
27       Starting with GDAL 1.10, it is possible to set the GDAL_NUM_THREADS
28       configuration option to parallelize the processing. The value to
29       specify is the number of worker threads, or ALL_CPUS to use all the
30       cores/CPUs of the computer.
31
32       -ot type:
33           For the output bands to be of the indicated data type.
34
35       -of format:
36           Select the output format. Starting with GDAL 2.3, if not specified,
37           the format is guessed from the extension (previously was GTiff).
38           Use the short format name.
39
40       -txe xmin xmax:
41           Set georeferenced X extents of output file to be created.
42
43       -tye ymin ymax:
44           Set georeferenced Y extents of output file to be created.
45
46       -outsize xsize ysize:
47           Set the size of the output file in pixels and lines.
48
49       -a_srs srs_def:
50           Override the projection for the output file. The srs_def may be any
51           of the usual GDAL/OGR forms, complete WKT, PROJ.4, EPSG:n or a file
52           containing the WKT. No reprojection is done.
53
54       -zfield field_name:
55           Identifies an attribute field on the features to be used to get a Z
56           value from. This value overrides Z value read from feature geometry
57           record (naturally, if you have a Z value in geometry, otherwise you
58           have no choice and should specify a field name containing Z value).
59
60       -z_increase increase_value:
61           Addition to the attribute field on the features to be used to get a
62           Z value from. The addition should be the same unit as Z value. The
63           result value will be Z value + Z increase value. The default value
64           is 0.
65
66       -z_multiply multiply_value:
67           This is multiplication ratio for Z field. This can be used for
68           shift from e.g. foot to meters or from elevation to deep. The
69           result value will be (Z value + Z increase value) * Z multiply
70           value. The default value is 1.
71
72       -a [algorithm[:parameter1=value1][:parameter2=value2]...]:
73           Set the interpolation algorithm or data metric name and
74           (optionally) its parameters. See INTERPOLATION ALGORITHMS and DATA
75           METRICS sections for further discussion of available options.
76
77       -spat xmin ymin xmax ymax:
78           Adds a spatial filter to select only features contained within the
79           bounding box described by (xmin, ymin) - (xmax, ymax).
80
81       -clipsrc [xmin ymin xmax ymax]|WKT|datasource|spat_extent:
82           Adds a spatial filter to select only features contained within the
83           specified bounding box (expressed in source SRS), WKT geometry
84           (POLYGON or MULTIPOLYGON), from a datasource or to the spatial
85           extent of the -spat option if you use the spat_extent keyword. When
86           specifying a datasource, you will generally want to use it in
87           combination of the -clipsrclayer, -clipsrcwhere or -clipsrcsql
88           options.
89
90       -clipsrcsql sql_statement:
91           Select desired geometries using an SQL query instead.
92
93       -clipsrclayer layername:
94           Select the named layer from the source clip datasource.
95
96       -clipsrcwhere expression:
97           Restrict desired geometries based on attribute query.
98
99       -l layername:
100           Indicates the layer(s) from the datasource that will be used for
101           input features. May be specified multiple times, but at least one
102           layer name or a -sql option must be specified.
103
104       -where expression:
105           An optional SQL WHERE style query expression to be applied to
106           select features to process from the input layer(s).
107
108       -sql select_statement:
109           An SQL statement to be evaluated against the datasource to produce
110           a virtual layer of features to be processed.
111
112       -co 'NAME=VALUE':
113           Passes a creation option to the output format driver. Multiple -co
114           options may be listed. See format specific documentation for legal
115           creation options for each format.
116
117       -q:
118           Suppress progress monitor and other non-error output.
119
120       src_datasource:
121           Any OGR supported readable datasource.
122
123       dst_filename:
124           The GDAL supported output file.
125

INTERPOLATION ALGORITHMS

127       There are number of interpolation algorithms to choose from.
128
129   invdist
130       Inverse distance to a power. This is default algorithm. It has
131       following parameters:
132
133       power:
134           Weighting power (default 2.0).
135
136       smoothing:
137           Smoothing parameter (default 0.0).
138
139       radius1:
140           The first radius (X axis if rotation angle is 0) of search ellipse.
141           Set this parameter to zero to use whole point array. Default is
142           0.0.
143
144       radius2:
145           The second radius (Y axis if rotation angle is 0) of search
146           ellipse. Set this parameter to zero to use whole point array.
147           Default is 0.0.
148
149       angle:
150           Angle of search ellipse rotation in degrees (counter clockwise,
151           default 0.0).
152
153       max_points:
154           Maximum number of data points to use. Do not search for more points
155           than this number. This is only used if search ellipse is set (both
156           radii are non-zero). Zero means that all found points should be
157           used. Default is 0.
158
159       min_points:
160           Minimum number of data points to use. If less amount of points
161           found the grid node considered empty and will be filled with NODATA
162           marker. This is only used if search ellipse is set (both radii are
163           non-zero). Default is 0.
164
165       nodata:
166           NODATA marker to fill empty points (default 0.0).
167
168   invdistnn
169       (Since GDAL 2.1) Inverse distance to a power with nearest neighbor
170       searching, ideal when max_points is used. It has following parameters:
171
172       power:
173           Weighting power (default 2.0).
174
175       smoothing:
176           Smoothing parameter (default 0.0).
177
178       radius:
179           The radius of the search circle, which should be non-zero. Default
180           is 1.0.
181
182       max_points:
183           Maximum number of data points to use. Do not search for more points
184           than this number. Found points will be ranked from nearest to
185           furthest distance when weighting. Default is 12.
186
187       min_points:
188           Minimum number of data points to use. If less amount of points
189           found the grid node is considered empty and will be filled with
190           NODATA marker. Default is 0.
191
192       nodata:
193           NODATA marker to fill empty points (default 0.0).
194
195   average
196       Moving average algorithm. It has following parameters:
197
198       radius1:
199           The first radius (X axis if rotation angle is 0) of search ellipse.
200           Set this parameter to zero to use whole point array. Default is
201           0.0.
202
203       radius2:
204           The second radius (Y axis if rotation angle is 0) of search
205           ellipse. Set this parameter to zero to use whole point array.
206           Default is 0.0.
207
208       angle:
209           Angle of search ellipse rotation in degrees (counter clockwise,
210           default 0.0).
211
212       min_points:
213           Minimum number of data points to use. If less amount of points
214           found the grid node considered empty and will be filled with NODATA
215           marker. Default is 0.
216
217       nodata:
218           NODATA marker to fill empty points (default 0.0).
219
220       Note, that it is essential to set search ellipse for moving average
221       method. It is a window that will be averaged when computing grid nodes
222       values.
223
224   nearest
225       Nearest neighbor algorithm. It has following parameters:
226
227       radius1:
228           The first radius (X axis if rotation angle is 0) of search ellipse.
229           Set this parameter to zero to use whole point array. Default is
230           0.0.
231
232       radius2:
233           The second radius (Y axis if rotation angle is 0) of search
234           ellipse. Set this parameter to zero to use whole point array.
235           Default is 0.0.
236
237       angle:
238           Angle of search ellipse rotation in degrees (counter clockwise,
239           default 0.0).
240
241       nodata:
242           NODATA marker to fill empty points (default 0.0).
243
244   linear
245       (Since GDAL 2.1) Linear interpolation algorithm.
246
247       The Linear method performs linear interpolation by computing a Delaunay
248       triangulation of the point cloud, finding in which triangle of the
249       triangulation the point is, and by doing linear interpolation from its
250       barycentric coordinates within the triangle. If the point is not in any
251       triangle, depending on the radius, the algorithm will use the value of
252       the nearest point or the nodata value.
253
254       It has following parameters:
255
256       radius:
257           In case the point to be interpolated does not fit into a triangle
258           of the Delaunay triangulation, use that maximum distance to search
259           a nearest neighbour, or use nodata otherwise. If set to -1, the
260           search distance is infinite. If set to 0, nodata value will be
261           always used. Default is -1.
262
263       nodata:
264           NODATA marker to fill empty points (default 0.0).
265

DATA METRICS

267       Besides the interpolation functionality gdal_grid can be used to
268       compute some data metrics using the specified window and output grid
269       geometry. These metrics are:
270
271       minimum:
272           Minimum value found in grid node search ellipse.
273
274       maximum:
275           Maximum value found in grid node search ellipse.
276
277       range:
278           A difference between the minimum and maximum values found in grid
279           node search ellipse.
280
281       count:
282           A number of data points found in grid node search ellipse.
283
284       average_distance:
285           An average distance between the grid node (center of the search
286           ellipse) and all of the data points found in grid node search
287           ellipse.
288
289       average_distance_pts:
290           An average distance between the data points found in grid node
291           search ellipse. The distance between each pair of points within
292           ellipse is calculated and average of all distances is set as a grid
293           node value.
294
295       All the metrics have the same set of options:
296
297       radius1:
298           The first radius (X axis if rotation angle is 0) of search ellipse.
299           Set this parameter to zero to use whole point array. Default is
300           0.0.
301
302       radius2:
303           The second radius (Y axis if rotation angle is 0) of search
304           ellipse. Set this parameter to zero to use whole point array.
305           Default is 0.0.
306
307       angle:
308           Angle of search ellipse rotation in degrees (counter clockwise,
309           default 0.0).
310
311       min_points:
312           Minimum number of data points to use. If less amount of points
313           found the grid node considered empty and will be filled with NODATA
314           marker. This is only used if search ellipse is set (both radii are
315           non-zero). Default is 0.
316
317       nodata:
318           NODATA marker to fill empty points (default 0.0).
319

READING COMMA SEPARATED VALUES

321       Often you have a text file with a list of comma separated XYZ values to
322       work with (so called CSV file). You can easily use that kind of data
323       source in gdal_grid. All you need is create a virtual dataset header
324       (VRT) for you CSV file and use it as input datasource for gdal_grid.
325       You can find details on VRT format at Virtual Format description page.
326
327       Here is a small example. Let we have a CSV file called dem.csv
328       containing
329
330       Easting,Northing,Elevation
331       86943.4,891957,139.13
332       87124.3,892075,135.01
333       86962.4,892321,182.04
334       87077.6,891995,135.01
335
336       For above data we will create dem.vrt header with the following
337       content:
338
339       <OGRVRTDataSource>
340           <OGRVRTLayer name="dem">
341               <SrcDataSource>dem.csv</SrcDataSource>
342               <GeometryType>wkbPoint</GeometryType>
343               <GeometryField encoding="PointFromColumns" x="Easting" y="Northing" z="Elevation"/>
344           </OGRVRTLayer>
345       </OGRVRTDataSource>
346
347       This description specifies so called 2.5D geometry with three
348       coordinates X, Y and Z. Z value will be used for interpolation. Now you
349       can use dem.vrt with all OGR programs (start with ogrinfo to test that
350       everything works fine). The datasource will contain single layer called
351       'dem' filled with point features constructed from values in CSV file.
352       Using this technique you can handle CSV files with more than three
353       columns, switch columns, etc.
354
355       If your CSV file does not contain column headers then it can be handled
356       in the following way:
357
358       <GeometryField encoding="PointFromColumns" x="field_1" y="field_2" z="field_3"/>
359
360       Comma Separated Value description page contains details on CSV format
361       supported by GDAL/OGR.
362

C API

364       Starting with GDAL 2.1, this utility is also callable from C with
365       GDALGrid().
366

EXAMPLE

368       The following would create raster TIFF file from VRT datasource
369       described in READING COMMA SEPARATED VALUES section using the inverse
370       distance to a power method. Values to interpolate will be read from Z
371       value of geometry record.
372
373       gdal_grid -a invdist:power=2.0:smoothing=1.0 -txe 85000 89000 -tye 894000 890000 -outsize 400 400 -of GTiff -ot Float64 -l dem dem.vrt dem.tiff
374
375       The next command does the same thing as the previous one, but reads
376       values to interpolate from the attribute field specified with -zfield
377       option instead of geometry record. So in this case X and Y coordinates
378       are being taken from geometry and Z is being taken from the 'Elevation'
379       field. The GDAL_NUM_THREADS is also set to parallelize the computation.
380
381       gdal_grid -zfield "Elevation" -a invdist:power=2.0:smoothing=1.0 -txe 85000 89000 -tye 894000 890000 -outsize 400 400 -of GTiff -ot Float64 -l dem dem.vrt dem.tiff --config GDAL_NUM_THREADS ALL_CPUS
382

AUTHORS

384       Andrey Kiselev dron@ak4719.spb.edu
385
386
387
388GDAL                            Wed Oct 3 2018                    gdal_grid(1)
Impressum