sits_geo_dist: Compute the minimum distances among samples and prediction...

View source: R/sits_geo_dist.R

sits_geo_distR Documentation

Compute the minimum distances among samples and prediction points.

Description

Compute the minimum distances among samples and samples to prediction points, following the approach proposed by Meyer and Pebesma(2022).

Usage

sits_geo_dist(samples, roi, n = 1000L, crs = "EPSG:4326")

Arguments

samples

Time series (tibble of class "sits").

roi

A region of interest (ROI), either a file containing a shapefile or an "sf" object

n

Maximum number of samples to consider (integer)

crs

CRS of the samples.

Value

A tibble with sample-to-sample and sample-to-prediction distances (object of class "distances").

Author(s)

Alber Sanchez, alber.ipia@inpe.br

Rolf Simoes, rolf.simoes@inpe.br

Felipe Carvalho, felipe.carvalho@inpe.br

Gilberto Camara, gilberto.camara@inpe.br

References

Meyer, H., Pebesma, E. "Machine learning-based global maps of ecological variables and the challenge of assessing them", Nature Communications 13, 2208 (2022). https://doi.org/10.1038/s41467-022-29838-9

Examples

if (sits_run_examples()) {
    # read a shapefile for the state of Mato Grosso, Brazil
    mt_shp <- system.file("extdata/shapefiles/mato_grosso/mt.shp",
        package = "sits"
    )
    # convert to an sf object
    mt_sf <- sf::read_sf(mt_shp)
    # calculate sample-to-sample and sample-to-prediction distances
    distances <- sits_geo_dist(
        samples = samples_modis_ndvi,
        roi = mt_sf
    )
    # plot sample-to-sample and sample-to-prediction distances
    plot(distances)
}

sits documentation built on Sept. 11, 2024, 6:36 p.m.