| neutralLandscapeMap | R Documentation |
Generates a SpatRaster of randomly-varying values on the same grid as a
template raster x, using a built-in Gaussian-smoothed random field with
no extra package dependencies.
neutralLandscapeMap(
x,
pad = 10L,
type = "gaussian",
smooth = 3L,
rescale = TRUE,
...
)
x |
A |
pad |
Integer. Number of cells by which to pad |
type |
Character. Only |
smooth |
Half-width (in cells) of the smoothing kernel; larger values produce smoother landscapes with longer-range autocorrelation. |
rescale |
If |
... |
Currently ignored; accepted for backwards compatibility. |
The "gaussian" generator fills a padded grid with i.i.d. normal noise,
then smooths it with a square mean kernel of size 2 * smooth + 1. The
result is a roughly Gaussian random field, suitable for sample modules,
demos, and tests.
A SpatRaster (or RasterLayer, matching x) with the same
extent, resolution, and CRS as x, filled with randomly-generated values.
library(terra)
nx <- ny <- 100L
r <- rast(nrows = ny, ncols = nx,
xmin = -nx/2, xmax = nx/2,
ymin = -ny/2, ymax = ny/2)
map_default <- neutralLandscapeMap(r)
if (interactive()) plot(map_default)
## Tweak smoothness:
map_rough <- neutralLandscapeMap(r, smooth = 1)
map_smooth <- neutralLandscapeMap(r, smooth = 8)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.