preview_gd | R Documentation |
Generate a preview of moving window size and sample counts based on the coordinates and
parameters to be supplied to window_gd, circle_gd, or resist_gd.
The method to be used should be specified with method = "window"
, "circle"
, or "resist"
. For method = "window"
,
wdim
must be specified. For method = "circle"
or "resist"
, maxdist
must be specified and
distmat
can also optionally be specified.
preview_gd(
lyr,
coords,
method = "window",
wdim = 3,
maxdist = NULL,
distmat = NULL,
fact = 0,
sample_count = TRUE,
min_n = 0,
plot = TRUE
)
lyr |
SpatRaster or RasterLayer to slide the window across (see Details for important information about projections). For |
coords |
coordinates of samples as sf points, a two-column matrix, or a data.frame representing x and y coordinates (see Details for important information about projections) |
method |
which method to use to create preview ( |
wdim |
if |
maxdist |
if |
distmat |
if |
fact |
aggregation factor to apply to |
sample_count |
whether to create plot of sample counts for each cell (defaults to TRUE) |
min_n |
minimum number of samples to use in calculations (any focal cell with a window containing less than this number of samples will be assigned a value of NA) |
plot |
whether to plot results (default = TRUE) |
Coordinates and rasters should be in a projected (planar) coordinate system such that raster cells are of equal sizes. Therefore, spherical systems (including latitute-longitude coordinate systems) should be projected prior to use. Transformation can be performed using st_set_crs for coordinates or project for rasters (see vignette for more details).
Plots preview of window and returns SpatRaster with sample counts layer (if sample_count = TRUE)
load_mini_ex()
preview_gd(mini_lyr, mini_coords, wdim = 3, fact = 3, sample_count = TRUE, min_n = 2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.