sample_jittered.RdReturns a function that performs jittered sampling on a spatial field. Regular points are generated first, then jittered by a random amount.
sample_jittered(amount, ...)Jitter amount in map units
Additional arguments passed to terra::spatSample()
A function that accepts x (SpatRaster) and size and returns an sf object
rast_grid = terra::rast(
ncols = 300, nrows = 100,
xmin = 0, xmax = 300,
ymin = 0, ymax = 100
)
sam_field(rast_grid, 100, method = sample_jittered(amount = 5))
#> Simple feature collection with 100 features and 0 fields
#> Geometry type: POINT
#> Dimension: XY
#> Bounding box: xmin: 3.457488 ymin: 7.508239 xmax: 299.1018 ymax: 92.47603
#> CRS: NA
#> First 10 features:
#> geometry
#> 1 POINT (3.457488 12.51721)
#> 2 POINT (18.7944 15.84796)
#> 3 POINT (33.34781 8.703525)
#> 4 POINT (40.41587 13.85646)
#> 5 POINT (56.45137 12.95235)
#> 6 POINT (63.09982 11.35624)
#> 7 POINT (75.66963 12.81739)
#> 8 POINT (87.15862 7.508239)
#> 9 POINT (107.1836 15.67355)
#> 10 POINT (110.3397 11.22687)