if ((requireNamespace("whitebox"))&&(isTRUE(whitebox::wbt_init()))) {
dem <- whitebox::sample_dem_data()
a1 <- c(DEM=read_gdal(dem))
a2 <- whiteboxing("BreachDepressions",input=a1)
b <- list(value=c(a1,a2),difference=c(diff=a1-a2))
print(b)
display(b,layout=c(2,NA),legend=list(list("first","left"),list("last","left")))
if (getRversion()>="4.1.0") {
a5 <- dem |>
whiteboxing("feature_preserving_smoothing",filter=9) |>
whiteboxing("breach_depressions") |>
print()
}
}
Run the code above in your browser using DataLab