GDAL Inverse Distance Weighted Nearest Neighbor Interpolation
Overview
Inverse Distance to a Power with Nearest Neighbor, abbreviated as Invdistnn, is an inverse distance weighted method constrained by the number of nearest neighbor points. Its core idea is to first identify several nearest sample points for the interpolation location, then use the distances to those points as the scale for defining the interpolation neighborhood.
Unlike traditional IDW, which uses a fixed search range, Invdistnn explicitly limits the number of sample points used in the calculation, usually taking only the nearest points. This strategy preserves continuity in the interpolation result while reducing unreasonable influence from distant sample points on local values. It is especially suitable for scenarios where sample points are unevenly distributed or density varies greatly.
How It Works
For any interpolation location , the estimated value still uses inverse distance weighted averaging:
The differences are:
- Dynamic neighborhood: The search radius is not fixed. It is dynamically determined by the distance to the nearest sample points.
- Point count constraint: Only the specified number () of sample points within that distance scale participate in weight calculation.
Use Cases
- High-density point cloud processing: For example, interpolate LiDAR ground points to generate a DEM.
- Uneven sampling modeling: In areas where sample points alternate between very dense and very sparse, such as samples collected along roads, this method helps prevent the interpolation surface from being excessively flattened by distant points.
- Local environmental modeling: Suitable for variables strongly affected by neighborhood conditions, such as soil nutrients or local temperature fluctuations.
Parameters
| Parameter | Description | Notes |
|---|---|---|
| Input vector file | The vector dataset containing the spatial point features to interpolate. | Supports multiple vector formats. |
| Interpolation field | The numeric attribute column used for interpolation. | Must be numeric. |
| Power | Controls the distance decay rate. The default value is 2. | Larger values make the influence of nearest neighbor points more prominent. |
| Smoothing | Reduces abrupt weight changes caused by very small distances. The default value is 1. | Helps keep the interpolation surface smooth. |
| Maximum points | Limits the maximum number of nearest points used in the calculation (max_points). | More distant points beyond this count are ignored. |
| Minimum points | The minimum number of sample points required for calculation (min_points). | If there are not enough valid points within the range, the result is set to NoData. |
| Output settings | Defines the spatial reference, extent, and cell size of the result raster. | See common raster output settings. |
| Output file | Specifies the storage location and file name of the output raster data. | See common raster output settings. |
Steps
- Start the tool: Open Raster Basic Tools > Interpolate to Raster, then double-click Nearest Neighbor Inverse Distance Interpolation.
- Set the input: Select the vector point layer and specify the attribute field to interpolate.
- Configure interpolation parameters:
- Set Maximum points, commonly 8 to 15, to keep the interpolation calculation local.
- Adjust Power to control the sharpness of the surface.
- Configure output properties: In Output settings, define the coordinate system, analysis extent, and resolution.
- Run the tool: Click Run.
Notes
- Localized characteristics: Invdistnn is a typical local interpolation method. It preserves local details well but cannot represent global trends.
- Step effect: If Maximum points is set very low, such as fewer than 3 points, the generated surface may appear blocky or stepped.
- Gap handling: In areas with extremely sparse sample points, the search distance required to meet the minimum point count may become too large. Use a mask tool afterward to optimize the boundary if needed.