An experimental alternative to the geos_strtree()
that provides a more
flexible interface and potentially faster spatial joins. Notably,
geos_basic_strtree_insert()
uses wk::wk_envelope()
instead of
as_geos_geometry()
and does not keep the underlying geometry in memory.
For object types like wk::xy()
with an optimized wk::wk_envelope()
method, this is very efficient.
geos_basic_strtree(items = NULL, node_capacity = 10L)
geos_basic_strtree_size(tree)
geos_basic_strtree_finalized(tree)
geos_basic_strtree_insert(tree, items)
geos_basic_strtree_query(tree, query, limit = NA, fill = FALSE)
geos_basic_strtree_query_filtered(
tree,
query,
tree_geom,
fun,
...,
.chunk_size = 65536
)
Items to add to the tree index
The maximum number of child nodes that a node may have. The minimum recommended capacity value is 4. If unsure, use a default node capacity of 10.
A geos_basic_strtree()
Items with which to query the tree
The maximum number of matches in the tree to return
If TRUE
, always returns limit
matches per item in query
padded with NA
if fewer than limit
matches are found.
A vctr coercible to geos_geometry()
whose indices
align with tree
.
A vectorized binary predicate (e.g. geos_intersects()
) that
will be called with the tree geometry, the query geometry and any ...
args passed.
Passed to fun
.
The approximate number of comparisons to pass to fun
.
A geos_basic_strtree object
tree <- geos_basic_strtree(wk::xy(1:5, 1:5))
geos_basic_strtree_size(tree)
#> [1] 5
(geos_basic_strtree_insert(tree, wk::xy(6:10, 6:10)))
#> [1] 6 7 8 9 10
geos_basic_strtree_query(tree, as_geos_geometry("LINESTRING (3 0, 0 3)"))
#> x tree
#> 1 1 1
#> 2 1 2
#> 3 1 3