Skip to contents

sf geometry predicates for post_array objects

Usage

st_mask(x, y, .predicate = st_intersects, ...)

Arguments

x

a post_array object

y

an object of class sf, sfc, sfg

.predicate

binary predicate to use (see ?sf::geos_binary_pred), defaults to st_intersects

...

passed on to the geometry predicate

Value

a one column matrix as the result of any features in y relating to any feature in x

Examples

library(sf)
arr = as_post_array(polygons, geometry_summary = summarise_geometry_union)
circles = list(st_point(c(0.55,0.5)), st_point(c(0.75,0.4))) |>
  st_sfc(crs = 4326) |>
  st_buffer(10000)
st_mask(arr, circles)
#>        [,1]
#>  [1,] FALSE
#>  [2,] FALSE
#>  [3,]  TRUE
#>  [4,]  TRUE
#>  [5,] FALSE
#>  [6,] FALSE
#>  [7,] FALSE
#>  [8,]  TRUE
#>  [9,]  TRUE
#> [10,] FALSE
#> [11,] FALSE
#> [12,] FALSE
#> [13,]  TRUE
#> [14,]  TRUE
#> [15,] FALSE
#> [16,] FALSE
#> [17,] FALSE
#> [18,] FALSE
#> [19,]  TRUE
#> [20,] FALSE
#> [21,] FALSE
#> [22,] FALSE
#> [23,]  TRUE
#> [24,]  TRUE
#> [25,] FALSE
arr$circles_disjoint = st_mask(arr, circles, .predicate = st_disjoint)