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.
prepare_spatial_filter(
filter_geom,
crs,
predicate,
error_call = rlang::caller_env()
)match_spatial_rel(predicate, error_call = rlang::caller_env())
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
an object of class bbox
, sfc
or sfg
used to filter
query results based on a predicate function.
a representation of a coordinate reference system.
Spatial predicate to use with filter_geom
. Default
"intersects"
. Possible options are "intersects"
, "contains"
,
"crosses"
, "overlaps"
, "touches"
, and "within"
.
default rlang::caller_env()
.
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.
prepare_spatial_filter(sf::st_point(c(0, 5)), 4326, "intersects")
Run the code above in your browser using DataLab