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 108 features and 0 fields
#> Geometry type: POINT
#> Dimension: XY
#> Bounding box: xmin: 3.907368 ymin: 3.959357 xmax: 296.2052 ymax: 95.73463
#> CRS: NA
#> First 10 features:
#> geometry
#> 1 POINT (5.41425 4.18113)
#> 2 POINT (25.37993 6.234502)
#> 3 POINT (40.33057 5.749201)
#> 4 POINT (53.63833 5.986722)
#> 5 POINT (75.07333 10.00247)
#> 6 POINT (90.22565 10.98215)
#> 7 POINT (111.4395 13.46165)
#> 8 POINT (127.6617 6.943711)
#> 9 POINT (141.3414 5.221523)
#> 10 POINT (163.0385 3.959357)