This tool can be used to interpolate a regular grid raster from a ShapeFile of Point ShapeType using the Inverse Distance to a Weight (IDW) interpolation method. Each grid cell in the output raster surface model (DEM) is assigned a value based on a distance-weighted combination of point value from the group of points contained within a circular area encompassing the grid cell. The user inputs one or more ShapeFile datasets and the field within the file's attribute table to be interpolated (if the input file is of a 'Z' type, then the 'Z' value can also be used in place of an attribute). The name of the output raster file must also be specified. The grid cell size and spatial extent of the output grid is determined by specifying either the Cell Size or an existing Base Raster File. One of these two options must be specified. If the user inputs a desired Cell Size, the output grid will have a spatial extent approximately matching that of the input ShapeFile. If the user instead inputs an existing base file raster, the output image will have the same grid cell resolution and extent as the base file. The user must also specify the search distance, defining the radius of the circular search neighbourhood used to identify nearby points.
The Weight Function is a mathematical relation that determines how the distance among neighbouring points will contribute to their weighting. The standard function used in IDW is known as Shepard's method after its orginator. Two alternative weight functions are possible including the method of Franke and Nielson (1980) and a modified version here called Lindsay's method. Both of these alternatives apply a less rapid decline in the weighting of points as distance increases compared with Shepard's method. The user must also specify the IDW exponent, used in the weight function. Larger exponent values will give relatively more weight to nearer points in the interpolation and lower values will result in a relatively smoother surface. The nodal functions used in inverse distance weighted interpolation can be higher degree polynomial functions constrained to pass through the scatter point and approximate the nearby points in a least squares manner. Quadratic polynomials have been found to work well in many cases (Franke and Nielson 1980; Franke 1982) and are used here as an alternative to the standard use of constant nodal functions.
Only points within the specified search radius will be used for the basis of interpolating grid values unless the user specifies a minimum number of points to be used greater than zero, in which case the search neighbourhood will be extended beyond its specified value until this minimum number of points is reached. Grid cells that have no points within the search radius assigned the NoData value in the output image. The output raster is of the float data type and continuous data scale.
The following is an example of a Python script using this tool:
wd = pluginHost.getWorkingDirectory()
# Specify the input file name and attribute
# separated by a semicolon
inputData = wd + "input.shp";"HEIGHT"
useZValues="false" # Used with 'Z' ShapeType
outputFile = wd + "output.shp"
gridRes = "1.5"
baseFile = "not specified"
weightType = "shepard's"
exponent = "2.0"
nodalFunc = "constant"
maxDistance = "1.5"
minNumNeighbours = "0"
useQuadSearch = "false"
args = [inputData, useZValues, outputFile, gridRes, baseFile, weightType, exponent, nodalFunc, maxDistance, minNumNeighbours, useQuadSearch]
pluginHost.runPlugin("InterpolationIDW", args, False)
This is a Groovy script also using this tool:
def wd = pluginHost.getWorkingDirectory()
// Specify the input file name and attribute
// separated by a semicolon
def inputData = wd + "input.shp";""
def useZValues="true" # Used with 'Z' ShapeType
def outputFile = wd + "output.shp"
def gridRes = "not specified"
def baseFile = wd + "otherGrid.dep"
def weightType = "franke"
def exponent = "2.0"
def nodalFunc = "quad"
def maxDistance = "1.5"
def minNumNeighbours = "5"
def useQuadSearch = "false"
String[] args = [inputData, useZValues, outputFile, gridRes, baseFile, weightType, exponent, nodalFunc, maxDistance, minNumNeighbours, useQuadSearch]
pluginHost.runPlugin("InterpolationIDW", args, false)