sam_field.RdCreate a sample of a spatial field.
sam_field(x, size, method = sample_random())A raster object (SpatRaster).
Number of samples to create.
Sampling method (function created by sample_random(),
sample_jittered(), or sample_clustered()).
An sf object with sampled points
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: 4.4779 ymin: 3.735812 xmax: 294.5015 ymax: 96.15376
#> CRS: NA
#> First 10 features:
#> geometry
#> 1 POINT (5.53674 3.735812)
#> 2 POINT (26.16662 5.221823)
#> 3 POINT (44.35406 6.63006)
#> 4 POINT (60.66815 9.56979)
#> 5 POINT (79.15347 8.74139)
#> 6 POINT (95.84905 9.437398)
#> 7 POINT (112.3639 12.04038)
#> 8 POINT (121.8196 12.11388)
#> 9 POINT (144.9495 5.885855)
#> 10 POINT (160.6316 6.186852)