This tool can be used to fill in small gaps in a raster or digital elevation
model (DEM). The gaps, or holes, must have recognized NoData values.
If gaps do not currently have this characteristic, use the
set_nodata_value
tool and ensure that the data are stored using
a raster format that supports NoData values.
All valid, non-NoData values in the input raster will be assigned the same
value in the output image.
Arguments
- x
Raster object of class WhiteboxRaster. See
wbw_read_raster()
for more details.- filter_size
integer
in grid cells is used to determine how far the algorithm will search for valid, non-NoData values. Therefore, setting a larger filter size allows for the filling of larger gaps in the input raster.- weight
double
, the IDW weight.- exclude_edge_nodata
boolean
, defaultFALSE
. It can be used to exclude NoData values that are connected to the edges of the raster. It is usually the case that irregularly shaped DEMs have large regions of NoData values along the containing raster edges. This flag can be used to exclude these regions from the gap-filling operation, leaving only interior gaps for filling.
Value
WhiteboxRaster object
Details
The algorithm uses an inverse-distance weighted (IDW) scheme based on the
valid values on the edge of NoData gaps to estimate gap values.
The user must specify the filter size (filter_size
), which
determines the size of gap that is filled, and the IDW weight
(weight
).
References
For more information, see https://www.whiteboxgeo.com/manual/wbw-user-manual/book/tool_help.html#fill_missing_data
Examples
f <- system.file("extdata/dem.tif", package = "wbw")
wbw_read_raster(f) |>
wbw_fill_missing_data()
#> +-----------------------------------------------+
#> | WhiteboxRaster |
#> | dem.tif |
#> |...............................................|
#> | bands : 1 |
#> | dimensions : 726, 800 (nrow, ncol) |
#> | resolution : 5.002392, 5.000243 (x, y) |
#> | EPSG : 2193 (Linear_Meter) |
#> | extent : 1925449 1929446 5582091 5585717 |
#> | min value : 63.698193 |
#> | max value : 361.020721 |
#> +-----------------------------------------------+