Skip to contents

Functions to ascertain the binary relationship between two geometry vectors. Binary predicates are provided both pairwise as a sparse matrix.

Usage

intersects_sparse(x, y)

intersects_pairwise(x, y)

contains_sparse(x, y)

contains_pairwise(x, y)

within_sparse(x, y)

within_pairwise(x, y)

Arguments

x

an object of class rsgeo

y

an object of class rsgeo

Value

  • For _sparse a list of integer vectors containing the position of the geometry in y

  • For _pairwise a logical vector

Examples

if (rlang::is_installed("sf")) {
    nc <- sf::st_read(
      system.file("shape/nc.shp", package = "sf"),
      quiet = TRUE
    )
    
    x <- as_rsgeo(nc$geometry[1:5])
    y <- rev(x)
    
    # intersects
    intersects_sparse(x, y)
    intersects_pairwise(x, y)
    # contains
    contains_sparse(x, y)
    contains_pairwise(x, y)
    # within
    within_sparse(x, y)
    within_pairwise(x, y)
}
#> [1] FALSE FALSE  TRUE FALSE FALSE