r.fillnulls(1)

πŸ’– r.fillnulls β€” the GRASS GIS manual, but make it make sense πŸ’–

okay bestie, so you know how raster maps sometimes have these sad little holes in them where there's just... no data? NULL. nothing. void. the void. r.fillnulls is the module that looks at those holes and goes "not on my watch" and fills them in using spline interpolation. it's giving glow-up for your raster ✨


✨ NAME ✨

r.fillnulls β€” fills no-data areas in raster maps using spline interpolation. that's it. that's the whole job. πŸ’…

🏷️ KEYWORDS 🏷️

raster, surface, elevation, interpolation, splines, no-data filling

iykyk if you've ever had a DEM with weird gaps in it πŸ¦‹


🌸 SYNOPSIS 🌸

r.fillnulls
r.fillnulls --help
r.fillnulls input=name output=name method=string  [tension=float]
[smooth=float]   [edge=integer]   [npmin=integer]   [segmax=integer]
[lambda=float]   [memory=memory in MB]   [--overwrite]  [--help]
[--verbose]  [--quiet]  [--ui]

πŸŽ€ Flags πŸŽ€

  • --overwrite β€” lets your output file just bulldoze whatever was already there. no cap, it will overwrite existing files.
  • --help β€” prints the usage summary so you can stop guessing.
  • --verbose β€” verbose module output, i.e. it tells you everything it's doing. main character energy, honestly.
  • --quiet β€” quiet module output. the opposite. shhh. 🀫
  • --ui β€” forces the GUI dialog to launch. for when you want buttons instead of typing.

πŸ“ Parameters πŸ“

  • input=name [required] β€” name of the input raster map. the one with the holes. the patient. 🩹
  • output=name [required] β€” name for the output raster map. the glow-up result.
  • method=string [required] β€” which interpolation method to use, bestie. Options: bilinear, bicubic, rst. Default: rst.
  • tension=float β€” the spline tension parameter. Default: 40.
  • smooth=float β€” the spline smoothing parameter. Default: 0.1
  • edge=integer β€” width of the hole edge used for interpolation, measured in cells. Options: 2-100. Default: 3
  • npmin=integer β€” minimum number of points for approximation in a segment (must be >segmax). Options: 2-10000. Default: 600
  • segmax=integer β€” maximum number of points in a segment. Options: 2-10000. Default: 300
  • lambda=float β€” Tykhonov regularization parameter (affects smoothing). Used in bilinear and bicubic spline interpolation. Default: 0.01
  • memory=memory in MB β€” maximum memory to be used (in MB). it's the cache size for raster rows. Default: 300

πŸ’œ DESCRIPTION πŸ’œ

so what does it actually do? r.fillnulls fills NULL pixels (the no data areas, the empty vibes) in an input raster map, and stores the filled data into a brand new output raster map. 🫢

the fill areas get interpolated from the no data area boundaries buffer, using v.surf.rst regularized spline interpolation with tension (that's method=rst) β€” or alternatively, r.resamp.bspline cubic or linear spline interpolation with Tykhonov regularization. pick your fighter. πŸ₯Š


πŸ“ NOTES πŸ“

Each area boundary buffer is set to three times the map resolution, so you get nominally three points around the edge. why tho? because that way the algorithm interpolates into the hole with a trained slope and curvature at the edges, so it avoids generating some boring flat plane inside your hole. nobody wants a flat plane. πŸ™…

The width of the edge area can be adjusted by changing the edge parameter. slay, customisation.

During the interpolation, the following warning may occur when using the RST method:

 Warning: strip exists with insufficient data
Warning: taking too long to find points for interpolation--please change
the region to area where your points are

This warning is generated if large data holes exist within the surface. but here's the tea: since the whole point of r.fillnulls is to fill exactly such holes, the user may ignore the warning. the interpolation will be continued. however, the user may want to pay attention to the notes below. πŸ‘€

If interpolation fails, temporary raster and vector maps are left in place so you can identify unfilled map holes (NULL areas) and manually repair them. not abandoned, just... still there. on purpose.

When using the default RST method, the algorithm is based on the v.surf.rst regularized splines with tension interpolation module, which interpolates the raster cell values for NULL data areas from the boundary values of the NULL data area. An eventual raster MASK is respected during the NULL data area(s) filling. The interpolated values are patched into the NULL data area(s) of the input map and saved into a new raster map.

Otherwise, either the linear or cubic spline interpolation with Tykhonov regularization can be selected (based on r.resamp.bspline). so many options, so few hours in the day. 🌈


⚠️ WARNING ⚠️

Depending on the shape of the NULL data area(s), problems may occur due to an insufficient number of input cell values for the interpolation process. Most problems will occur if a NULL data area reaches a large amount of the map boundary. The user will have to carefully check the result using r.mapcalc (generating a difference map to the input map and applying the "differences" color table with r.colors) and/or to query individual cell values.
RST method stores temporary maps on hard disk. It will require at least as much free space as one extra input raster map takes. so like, check your disk space bestie, fr fr. πŸ’€

🧚 EXAMPLE 🧚

In this example, the SRTM elevation map in the North Carolina sample dataset is filtered for outlier elevation values; missing pixels are then re-interpolated to obtain a complete elevation map:

g.region raster=elev_srtm_30m -p
d.mon wx0
d.histogram elev_srtm_30m
# remove SRTM outliers, i.e. SRTM below 50m (esp. lakes), leading to no data areas
r.mapcalc "elev_srtm_30m_filt = if(elev_srtm_30m < 50.0, null(), elev_srtm_30m)"
d.histogram elev_srtm_30m_filt
d.rast elev_srtm_30m_filt
# using the default RST method to fill these holes in DEM
r.fillnulls input=elev_srtm_30m_filt output=elev_srtm_30m_rst tension=20
# using the bilinear method to fill these holes in DEM
r.fillnulls input=elev_srtm_30m_filt output=elev_srtm_30m_bilin method=bilinear
d.histogram elev_srtm_30m_rst
d.rast elev_srtm_30m_rst
d.erase
d.histogram elev_srtm_30m_bilin
d.rast elev_srtm_30m_bilin
r.mapcalc "diff_rst_bilin = elev_srtm_30m_rst - elev_srtm_30m_bilin"
r.colors diff_rst_bilin color=differences
r.univar -e diff_rst_bilin
d.erase
d.rast diff_rst_bilin
d.legend diff_rst_bilin

πŸ“š REFERENCES πŸ“š

  1. Mitas, L., Mitasova, H., 1999, Spatial Interpolation. In: P.Longley, M.F. Goodchild, D.J. Maguire, D.W.Rhind (Eds.), Geographical Information Systems: Principles, Techniques, Management and Applications, Wiley, pp.481-492
  2. Mitasova H., Mitas L., Brown W.M., D.P. Gerdes, I. Kosinovsky, Baker, T.1995, Modeling spatially and temporally distributed phenomena: New methods and tools for GRASS GIS. International Journal of GIS, 9 (4), special issue on Integrating GIS and Environmental modeling, 433-446.
  3. Mitasova H. and Mitas L. 1993: Interpolation by Regularized Spline with Tension: I. Theory and Implementation, Mathematical Geology 25, 641-655.
  4. Mitasova H. and Hofierka L. 1993: Interpolation by Regularized Spline with Tension: II. Application to Terrain Modeling and Surface Geometry Analysis, Mathematical Geology 25, 657-667.

the academic citations really said "here's the lore" πŸ“–


πŸ‘€ SEE ALSO πŸ‘€

r.fill.dir, r.mapcalc, r.resamp.bspline, v.surf.bspline, v.surf.rst, v.fill.holes

go read those too, they're all in the family. πŸ’–


πŸ‘‘ AUTHORS πŸ‘‘

  • Markus Neteler, University of Hannover and Fondazione Edmund Mach
  • Improvement by Hamish Bowman, NZ

πŸ”— SOURCE CODE πŸ”—

Available at: r.fillnulls source code (history)

Accessed: Saturday Jan 17 05:41:52 2026

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


and that's the whole page bestie!! this was GRASS GIS 8.4.2, and the copyright goes Β© 2003-2025 GRASS Development Team, GRASS GIS 8.4.2 Reference Manual. ✨ go fill some holes, you've got this, mwah πŸ’…πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from