You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#' @param y object of class \code{sf}, \code{sfc} or \code{sfg}; if missing, \code{x} is used
115
115
#' @param sparse logical; should a sparse index list be returned (`TRUE`) or a dense logical matrix? See below.
116
116
#' @inheritDotParams s2::s2_options
117
-
#' @param prepared logical; prepare geometry for `x`, before looping over `y`? See Details.
118
-
#' @details If \code{prepared} is \code{TRUE}, and \code{x} contains POINT geometries and \code{y} contains polygons, then the polygon geometries are prepared, rather than the points.
119
117
#' @return If \code{sparse=FALSE}, \code{st_predicate} (with \code{predicate} e.g. "intersects") returns a dense logical matrix with element \code{i,j} equal to \code{TRUE} when \code{predicate(x[i], y[j])} (e.g., when geometry of feature i and j intersect); if \code{sparse=TRUE}, an object of class \code{\link{sgbp}} is returned, which is a sparse list representation of the same matrix, with list element \code{i} an integer vector with all indices \code{j} for which \code{predicate(x[i],y[j])} is \code{TRUE} (and hence a zero-length integer vector if none of them is \code{TRUE}). From the dense matrix, one can find out if one or more elements intersect by \code{apply(mat, 1, any)}, and from the sparse list by \code{lengths(lst) > 0}, see examples below.
120
118
#' @details For most predicates, a spatial index is built on argument \code{x}; see \url{https://r-spatial.org/r/2017/06/22/spatial-index.html}.
121
119
#' Specifically, \code{st_intersects}, \code{st_disjoint}, \code{st_touches} \code{st_crosses}, \code{st_within}, \code{st_contains}, \code{st_contains_properly}, \code{st_overlaps}, \code{st_equals}, \code{st_covers} and \code{st_covered_by} all build spatial indexes for more efficient geometry calculations. \code{st_relate}, \code{st_equals_exact}, and do not; \code{st_is_within_distance} uses a spatial index for geographic coordinates when \code{sf_use_s2()} is true.
#' @details If \code{prepared} is \code{TRUE}, and \code{x} contains POINT geometries and \code{y} contains polygons, then the polygon geometries are prepared, rather than the points.
175
+
176
+
#' @param prepared logical; prepare geometry for `x`, before looping over `y`? See Details.
182
177
#' @export
183
178
st_touches=function(x, y, sparse=TRUE, prepared=TRUE, ...)
184
179
st_geos_binop("touches", x, y, sparse=sparse, prepared=prepared, ...)
#' * `st_equals_exact()` returns true for two geometries of the same type and their vertices corresponding by index are equal up to a specified tolerance.
229
225
#'
230
-
#' @inheritParams st_intersects
226
+
#' @inheritParams geos_binary_pred
231
227
#' @param retain_unique logical; if `TRUE` (and `y` is missing) return only
232
228
#' indexes of points larger than the current index; this can be used to select
233
229
#' unique geometries, see examples. This argument can be used for all geometry predicates;
234
230
#' see also \link{distinct.sf} to find records where geometries AND attributes are distinct.
235
-
#' @param remove_self logical; if `TRUE` (and `y` is missing) return only indexes of geometries different from the current index; this can be used to omit self-intersections; see examples. This argument can be used for all geometry predicates
231
+
#' @param remove_self logical; if `TRUE` (and `y` is missing) return only indexes of geometries different from the current index; this can be used to omit self-intersections; see examples.
232
+
#' This argument can be used for all geometry predicates
233
+
#' @param ... passed on to [s2::s2_equals()]
236
234
#' @export
237
235
#' @family geometric binary predicates for two spatial objects
0 commit comments