gdal_grid(1) | General Commands Manual | gdal_grid(1) |

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

**-ot***type***:**- For the output bands to be of the indicated data type.

**-of***format***:**- Select the output format. The default is GeoTIFF (GTiff). Use the short format name.

**-txe***xmin xmax***:**- Set georeferenced X extents of output file to be created.

**-tye***ymin ymax***:**- Set georeferenced Y extents of output file to be created.

**-outsize***xsize ysize***:**- Set the size of the output file in pixels and lines.

**-a_srs***srs_def***:**- Override the projection for the output file. The
*srs_def*may be any of the usual GDAL/OGR forms, complete WKT, PROJ.4, EPSG:n or a file containing the WKT.

**-zfield***field_name***:**- Identifies an attribute field on the features to be used to get a Z value from. This value overrides Z value read from feature geometry record (naturally, if you have a Z value in geometry, otherwise you have no choice and should specify a field name containing Z value).

**-z_increase***increase_value***:**- Addition to the attribute field on the features to be used to get a Z value from. The addition should be the same unit as Z value. The result value will be Z value + Z increase value. The default value is 0.

**-z_multiply***multiply_value***:**- This is multiplication ratio for Z field. This can be used for shift from e.g. foot to meters or from elevation to deep. The result value will be (Z value + Z increase value) * Z multiply value. The default value is 1.

**-a***[algorithm[:parameter1=value1][:parameter2=value2]...]***:**- Set the interpolation algorithm or data metric name and
(optionally) its parameters. See
**INTERPOLATION ALGORITHMS**and**DATA METRICS**sections for further discussion of available options.

**-spat***xmin ymin xmax ymax***:**- Adds a spatial filter to select only features contained within the bounding box described by (xmin, ymin) - (xmax, ymax).

**-clipsrc***[xmin ymin xmax ymax]|WKT|datasource|spat_extent***:**- Adds a spatial filter to select only features contained
within the specified bounding box (expressed in source SRS), WKT geometry
(POLYGON or MULTIPOLYGON), from a datasource or to the spatial extent of
the
**-spat**option if you use the*spat_extent*keyword. When specifying a datasource, you will generally want to use it in combination of the**-clipsrclayer**,**-clipsrcwhere**or**-clipsrcsql**options.

**-clipsrcsql***sql_statement***:**- Select desired geometries using an SQL query instead.

**-clipsrclayer***layername***:**- Select the named layer from the source clip datasource.

**-clipsrcwhere***expression***:**- Restrict desired geometries based on attribute query.

**-l***layername***:**- Indicates the layer(s) from the datasource that will be
used for input features. May be specified multiple times, but at least one
layer name or a
**-sql**option must be specified.

**-where***expression***:**- An optional SQL WHERE style query expression to be applied to select features to process from the input layer(s).

**-sql***select_statement***:**- An SQL statement to be evaluated against the datasource to produce a virtual layer of features to be processed.

**-co***'NAME=VALUE'***:**- Passes a creation option to the output format driver.
Multiple
**-co**options may be listed. See format specific documentation for legal creation options for each format.

**-q****:**- Suppress progress monitor and other non-error output.

*src_datasource***:**- Any OGR supported readable datasource.

*dst_filename***:**- The GDAL supported output file.

*power***:**- Weighting power (default 2.0).

*smoothing***:**- Smoothing parameter (default 0.0).

*radius1***:**- The first radius (X axis if rotation angle is 0) of search ellipse. Set this parameter to zero to use whole point array. Default is 0.0.

*radius2***:**- The second radius (Y axis if rotation angle is 0) of search ellipse. Set this parameter to zero to use whole point array. Default is 0.0.

*angle***:**- Angle of search ellipse rotation in degrees (counter clockwise, default 0.0).

*max_points***:**- Maximum number of data points to use. Do not search for more points than this number. This is only used if search ellipse is set (both radii are non-zero). Zero means that all found points should be used. Default is 0.

*min_points***:**- Minimum number of data points to use. If less amount of points found the grid node considered empty and will be filled with NODATA marker. This is only used if search ellipse is set (both radii are non-zero). Default is 0.

*nodata***:**- NODATA marker to fill empty points (default 0.0).

*power***:**- Weighting power (default 2.0).

*smoothing***:**- Smoothing parameter (default 0.0).

*radius***:**- The radius of the search circle, which should be non-zero. Default is 1.0.

*max_points***:**- Maximum number of data points to use. Do not search for more points than this number. Found points will be ranked from nearest to furthest distance when weighting. Default is 12.

*min_points***:**- Minimum number of data points to use. If less amount of points found the grid node is considered empty and will be filled with NODATA marker. Default is 0.

*nodata***:**- NODATA marker to fill empty points (default 0.0).

*radius1***:**- The first radius (X axis if rotation angle is 0) of search ellipse. Set this parameter to zero to use whole point array. Default is 0.0.

*radius2***:**- The second radius (Y axis if rotation angle is 0) of search ellipse. Set this parameter to zero to use whole point array. Default is 0.0.

*angle***:**- Angle of search ellipse rotation in degrees (counter clockwise, default 0.0).

*min_points***:**- Minimum number of data points to use. If less amount of points found the grid node considered empty and will be filled with NODATA marker. Default is 0.

*nodata***:**- NODATA marker to fill empty points (default 0.0).

*radius1***:**- The first radius (X axis if rotation angle is 0) of search ellipse. Set this parameter to zero to use whole point array. Default is 0.0.

*radius2***:**- The second radius (Y axis if rotation angle is 0) of search ellipse. Set this parameter to zero to use whole point array. Default is 0.0.

*angle***:**- Angle of search ellipse rotation in degrees (counter clockwise, default 0.0).

*nodata***:**- NODATA marker to fill empty points (default 0.0).

*radius***:**- In case the point to be interpolated does not fit into a triangle of the Delaunay triangulation, use that maximum distance to search a nearest neighbour, or use nodata otherwise. If set to -1, the search distance is infinite. If set to 0, nodata value will be always used. Default is -1.

*nodata***:**- NODATA marker to fill empty points (default 0.0).

*minimum***:**- Minimum value found in grid node search ellipse.

*maximum***:**- Maximum value found in grid node search ellipse.

*range***:**- A difference between the minimum and maximum values found in grid node search ellipse.

*count***:**- A number of data points found in grid node search ellipse.

*average_distance***:**- An average distance between the grid node (center of the search ellipse) and all of the data points found in grid node search ellipse.

*average_distance_pts***:**- An average distance between the data points found in grid node search ellipse. The distance between each pair of points within ellipse is calculated and average of all distances is set as a grid node value.

*radius1***:**

*radius2***:**

*angle***:**- Angle of search ellipse rotation in degrees (counter clockwise, default 0.0).

*min_points***:**- Minimum number of data points to use. If less amount of points found the grid node considered empty and will be filled with NODATA marker. This is only used if search ellipse is set (both radii are non-zero). Default is 0.

*nodata***:**- NODATA marker to fill empty points (default 0.0).

Easting,Northing,Elevation 86943.4,891957,139.13 87124.3,892075,135.01 86962.4,892321,182.04 87077.6,891995,135.01For above data we will create

<OGRVRTDataSource> <OGRVRTLayer name="dem"> <SrcDataSource>dem.csv</SrcDataSource> <GeometryType>wkbPoint</GeometryType> <GeometryField encoding="PointFromColumns" x="Easting" y="Northing" z="Elevation"/> </OGRVRTLayer> </OGRVRTDataSource>This description specifies so called 2.5D geometry with three coordinates X, Y and Z. Z value will be used for interpolation. Now you can use

<GeometryField encoding="PointFromColumns" x="field_1" y="field_2" z="field_3"/>Comma Separated Value description page contains details on CSV format supported by GDAL/OGR.

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.tiffThe next command does the same thing as the previous one, but reads values to interpolate from the attribute field specified with

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

Sun Oct 29 2017 | GDAL |