r.surf.idw(1)

✨ r.surf.idw ✨

okay bestie, this is r.surf.idw, straight out of the GRASS GIS User's Manual β€” section (1), meaning she's a command you run from the shell. And she's lowkey iconic: she fills a whole grid with interpolated values using Inverse Distance Squared Weighting. Let's get into it πŸ’…

🌸 KEYWORDS 🌸

raster, surface, interpolation, IDW

πŸŽ€ SYNOPSIS πŸŽ€

r.surf.idw
r.surf.idw --help
r.surf.idw [-e] input=name output=name  [npoints=integer]
[--overwrite]  [--help]  [--verbose]  [--quiet]  [--ui]

πŸ¦‹ Flags

  • -e β€” output is the interpolation error
  • --overwrite β€” let output files overwrite existing files, no cap
  • --help β€” print usage summary
  • --verbose β€” verbose module output
  • --quiet β€” quiet module output
  • --ui β€” force launching GUI dialog

πŸ“ Parameters

  • input=name [required] β€” name of input raster map
  • output=name [required] β€” name for output raster map
  • npoints=integer β€” number of interpolation points. Default: 12

πŸ’– DESCRIPTION πŸ’–

So basically, r.surf.idw fills a grid cell (raster) matrix with interpolated values that it generates from input raster data points. She uses a numerical approximation technique based on distance squared weighting of the values of the nearest data points. And you get to choose how many nearest data points feed into the interpolated value of a cell β€” that's your call as the user (default: 12 nearest data points).

If there's a current working mask, bestie, it applies to the output raster map. Only those cells falling within the mask get interpolated values. But heads up: the search procedure for selecting nearest neighboring points considers all input data, without regard to the mask. Not the mask's business, fr fr. πŸ™ˆ

The -e flag is the error analysis option β€” it interpolates values only for those cells of the input raster map which have non-zero values, and outputs the difference (see NOTES below, don't skip ahead πŸ‘€).

The npoints parameter defines the number of nearest data points used to determine the interpolated value of an output raster cell.


πŸ”₯ NOTES πŸ”₯

r.surf.idw is a surface generation utility that uses inverse distance squared weighting β€” as described in Applied Geostatistics by E. H. Isaaks and R. M. Srivastava, Oxford University Press, 1989 β€” to assign interpolated values. The implementation includes a customized data structure somewhat akin to a sparse matrix, which enhances the efficiency with which nearest data points are selected. And for latitude/longitude projections, distances are calculated from point to point along a geodesic. 🌈

Unlike r.surf.idw2 (addon), which processes all input data points in each interpolation cycle, r.surf.idw tries to minimize the number of input data for which distances must be calculated. Execution speed is therefore a function of the search effort, and does not increase appreciably with the number of input data points. She's efficient like that πŸ’…

r.surf.idw will generally outperform r.surf.idw2 except when the input data layer contains few non-zero data β€” i.e. when the cost of the search exceeds the cost of the additional distance calculations performed by r.surf.idw2. The relative performance of these utilities will depend on the comparative speed of boolean, integer and floating point operations on a particular platform. It's giving "depends on your machine," bestie.

Worst case search performance by r.surf.idw happens when the interpolated cell is located outside of the region in which input data are distributed. So it behooves the user β€” yes, you β€” to employ a mask when geographic region boundaries include large areas outside the general extent of the input data. 🫢

The degree of smoothing produced by the interpolation will increase relative to the number of nearest data points considered. The utility may be used with regularly or irregularly spaced input data. However, the output result for the former may include unacceptable nonconformities in the surface pattern. 😭

🧚 Surface-generation error analysis 🧚

The -e flag option provides a standard surface-generation error analysis facility. It produces an output raster map of the difference of interpolated values minus input values, for those cells whose input data are non-zero. For each interpolation cycle, the known value of the cell under consideration is ignored, and the remaining input values are used to interpolate a result. The output raster map may be compared to the input raster map to analyze the distribution of interpolation error. This procedure may be helpful in choosing the number of nearest neighbors considered for surface generation. ⭐


πŸ’€ KNOWN ISSUES πŸ’€

Module r.surf.idw works only for integer (CELL) raster maps. That's it, that's the issue. No floating point girlies allowed. πŸŽ€


πŸ‘‘ SEE ALSO πŸ‘‘

  • r.surf.contour
  • r.surf.gauss
  • r.surf.fractal
  • r.surf.random
  • v.surf.idw
  • v.surf.rst

Overview: Interpolation and Resampling in GRASS GIS


🌟 AUTHOR 🌟

Greg Koerper Global Climate Research Project U.S. EPA Environmental Research Laboratory 200 S.W. 35th Street, JSB Corvallis, OR 97333


πŸ’œ SOURCE CODE πŸ’œ

Available at: r.surf.idw source code (history)

Accessed: Saturday Jan 17 05:41:02 2026

Main index | Raster index | Topics index | Keywords index | Graphical index | Full index


okay that's the whole page, and literally every last detail made it through, periodt πŸ’…

Β© 2003-2025 GRASS Development Team, from the GRASS GIS 8.4.2 Reference Manual β€” and yeah, she's GRASS 8.4.2, r.surf.idw(1), mwah. slay, bye bestie πŸ¦‹βœ¨

πŸ“¦ where this page comes from