Binary logical operations (2)

Binary logical operations (binary predicate functions) describe the topological relationship between a pair of simple features.

Applied to two sf objects, they return:

  • either a sparse matrix (sgbp class: sparse geometry binary predicate),
  • or a dense matrix.
sparse <- st_intersects(x, y)
sparse
## Sparse geometry binary predicate list of length 3, where the predicate
## was `intersects'
##  1: 1, 3
##  2: 2, 3
##  3: 3
class(sparse)
## [1] "sgbp" "list"
str(sparse, give.attr = FALSE)
## List of 3
##  $ : int [1:2] 1 3
##  $ : int [1:2] 2 3
##  $ : int 3