This function filters features from the first layer based on their spatial relationship with features in the second layer using various spatial predicates.
turf_filter(
map,
layer_id = NULL,
filter_layer_id = NULL,
data = NULL,
filter_data = NULL,
predicate = c("intersects", "within", "contains", "crosses", "disjoint"),
source_id,
input_id = NULL
)
The map or proxy object for method chaining.
A mapboxgl, maplibre, mapboxgl_proxy, or maplibre_proxy object.
The ID of the layer or source to filter (mutually exclusive with data).
The ID of the layer or source to filter against (mutually exclusive with filter_data).
An sf object containing features to filter (mutually exclusive with layer_id).
An sf object containing the filter geometry (mutually exclusive with filter_layer_id).
The spatial relationship to test. One of: "intersects", "within", "contains", "crosses", "disjoint".
The ID for the new source containing the filtered results. Required.
Optional. Character string specifying the Shiny input ID suffix for storing results. If NULL (default), no input is registered. For proxy operations, the result will be available as input[[paste0(map_id, "_turf_", input_id)]]
.