Learn R Programming

rsgeo (version 0.1.7)

intersects_sparse: Binary Predicates

Description

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)

Value

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

  • For _pairwise a logical vector

Arguments

x

an object of class rsgeo

y

an object of class rsgeo

Examples

Run this code
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)
}

Run the code above in your browser using DataLab