sample_random.RdReturns a function that performs random sampling on a spatial field.
sample_random(...)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_random())
#> Simple feature collection with 100 features and 0 fields
#> Geometry type: POINT
#> Dimension: XY
#> Bounding box: xmin: 1.5 ymin: 3.5 xmax: 296.5 ymax: 99.5
#> CRS: NA
#> First 10 features:
#> geometry
#> 1 POINT (196.5 29.5)
#> 2 POINT (1.5 72.5)
#> 3 POINT (68.5 75.5)
#> 4 POINT (6.5 30.5)
#> 5 POINT (99.5 22.5)
#> 6 POINT (20.5 10.5)
#> 7 POINT (187.5 70.5)
#> 8 POINT (275.5 49.5)
#> 9 POINT (139.5 79.5)
#> 10 POINT (8.5 59.5)