prepare_spatial_filter() prepares a named list with ESRI JSON geometry for
use as a spatial filter based on a a sfc, sfg, or bbox input object.
match_spatial_rel() takes a scalar character vector with a predicate name
to a type of ESRI spatial relation.
Usage
prepare_spatial_filter(
filter_geom,
crs,
predicate,
error_call = rlang::caller_env()
)
match_spatial_rel(predicate, error_call = rlang::caller_env())Arguments
- filter_geom
an object of class
bbox,sfcorsfgused to filter query results based on a predicate function.- crs
a representation of a coordinate reference system.
- predicate
Spatial predicate to use with
filter_geom. Default"intersects". Possible options are"intersects","contains","crosses","overlaps","touches", and"within".- error_call
default
rlang::caller_env().
Value
prepare_spatial_filter() returns a named list with the
geometryType, geometry (as Esri JSON), and spatial relation predicate.
match_spatial_rel() returns one of the following spatial binary predicates:
esriSpatialRelIntersects
esriSpatialRelContains
esriSpatialRelCrosses
esriSpatialRelOverlaps
esriSpatialRelTouches
esriSpatialRelWithin
Details
Using sfc objects as filter_geom
If an sfc object is provided it will be transformed to the layers spatial
reference. If the sfc is missing a CRS (or is an sfg object) it is
assumed to use the same spatial reference as the FeatureLayer. If the sfc
object has multiple features, the features are unioned with
sf::st_union(). If an sfc object has MULTIPOLYGON geometry, the
features are cast to POLYGON geometry and only the first element is used.